Skip to content

Instantly share code, notes, and snippets.

@MattTheRed
Last active December 21, 2015 08:49
Show Gist options
  • Save MattTheRed/6280592 to your computer and use it in GitHub Desktop.
Save MattTheRed/6280592 to your computer and use it in GitHub Desktop.
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