Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
class MaskedCreditCardField(models.CharField): def __init__(self, *args, **kwargs): kwargs['max_length'] = 20 super().__init__(*args, **kwargs) def to_python(self, value): if not isinstance(value, str): raise ValidationError("The card number must be a string") if not value.isdigit(): raise ValidationError("The card number must contain only digits") if len(value) != 16: raise ValidationError("The card number must be exactly 16 characters long") return f"****-****-****-{value[-4:]}" class CreditCard(models.Model): card_owner = models.CharField(max_length=100) card_number - MaskedCreditCardField()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)