Last active
June 19, 2018 17:29
-
-
Save katie7r/c1f551a1b91fabe84a9b4b41fa0302d8 to your computer and use it in GitHub Desktop.
Django pseudonymization example - Starting point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.core.validators import RegexValidator | |
from django.contrib.auth.models import AbstractUser | |
class User(AbstractUser): | |
phone_regex = RegexValidator( | |
regex=r'^\+?[1-9]\d{1,14}$', | |
message="Phone number must have the format: '+9999999999'.", | |
) | |
name = models.CharField(max_length=128, blank=True) | |
phone = models.CharField(validators=[phone_regex], max_length=17, blank=True) | |
date_of_birth = models.DateField(blank=True, null=True) | |
ip_address = models.GenericIPAddressField(blank=True, null=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment