Skip to content

Instantly share code, notes, and snippets.

@MattTheRed
Last active December 21, 2015 08:49
Show Gist options
  • Save MattTheRed/6280647 to your computer and use it in GitHub Desktop.
Save MattTheRed/6280647 to your computer and use it in GitHub Desktop.
class CustomUserManager(CustomUserManager):
def create_user(self, email,
password=None):
user = self.model(email=email, password=password)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email,
password):
user = self.create_user(email,
password=password)
user.is_staff = True
user.is_admin = True
user.is_superuser = True
user.save(using=self._db)
return user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment