from django.db import models from django.contrib.auth.models import AbstractUser from django.utils.safestring import mark_safe from django.conf import settings from .managers import UserProfileManager from django.utils.translation import gettext_lazy as _ class UserProfile(AbstractUser): email = models.EmailField(_("email address"), max_length=255, unique=True) username = models.CharField(_("username"), max_length=63, unique=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username'] objects = UserProfileManager()