Titivillus/users/models.py

33 lines
827 B
Python

#!/usr/bin/env python3
"""
A custom user model.
"""
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.validators import UnicodeUsernameValidator
class User(AbstractUser):
"""
A custom user model.
"""
username_validator = UnicodeUsernameValidator()
username = models.CharField(
_('username'),
max_length=20,
unique=True,
help_text=_("Required. 20 characters or fewer. "
+ "Letters, digits and @/./+/-/_ only."),
validators=[username_validator],
error_messages={
'unique': _("A user with that username already exists."),
},)
first_name = None
last_name = None
email = models.EmailField(_('email address'))
def get_full_name(self):
return None
def get_short_name(self):
return None