Last active
December 21, 2015 08:49
-
-
Save MattTheRed/6280592 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin | |
class CustomUser(AbstractBaseUser, PermissionsMixin): | |
email = models.EmailField(unique=True) | |
website_url = models.URLField(max_length=255) | |
is_active = models.BooleanField(default=True) | |
is_staff = models.BooleanField(default=False) | |
is_admin = models.BooleanField(default=False) | |
USERNAME_FIELD = "email" | |
REQUIRED_FIELDS = ["website_url"] | |
objects = CustomUserManager() | |
def get_full_name(self): | |
return self.email | |
def get_short_name(self): | |
return self.email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment