You've already forked STARK
mirror of
https://github.com/MarkParker5/STARK.git
synced 2025-07-02 22:36:54 +02:00
28 lines
675 B
Python
28 lines
675 B
Python
![]() |
from django.contrib.auth.models import BaseUserManager
|
||
|
|
||
|
|
||
|
class UserManager(BaseUserManager):
|
||
|
|
||
|
def create_user(self, email, password = None):
|
||
|
|
||
|
if email is None:
|
||
|
raise TypeError('Users must have an email address.')
|
||
|
|
||
|
user = self.model(email = self.normalize_email(email))
|
||
|
user.set_password(password)
|
||
|
user.save()
|
||
|
|
||
|
return user
|
||
|
|
||
|
def create_superuser(self, email, password):
|
||
|
|
||
|
if password is None:
|
||
|
raise TypeError('Superusers must have a password.')
|
||
|
|
||
|
user = self.create_user(email, password)
|
||
|
user.is_superuser = True
|
||
|
user.is_staff = True
|
||
|
user.save()
|
||
|
|
||
|
return user
|