daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 372 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use_in_migrations = True
  2.  
  3. def _create_user(self, username, email, password, **extra_fields):
  4.     """
  5.    Creates and saves a User with the given username, email and password.
  6.    """
  7.     if not username:
  8.         raise ValueError('The given username must be set')
  9.     email = self.normalize_email(email)
  10.     username = self.model.normalize_username(username)
  11.     user = self.model(username=username, email=email, **extra_fields)
  12.     user.set_password(password)
  13.     user.save(using=self._db)
  14.     return user
  15.  
  16. def create_user(self, username, email=None, password=None, **extra_fields):
  17.     ...
  18.  
  19. def create_superuser(self, username, email, password, **extra_fields):
  20.     ...
  21.  
  22. def create_controller(self, username, email, password, **extra_fields):
  23.     extra_fields.setdefault('is_staff', True)
  24.     extra_fields.setdefault('is_superuser', False)
  25.  
  26.     if extra_fields.get('is_staff') is not True:
  27.         raise ValueError('Controller must have is_staff=True.')
  28.  
  29.     return self._create_user(username, email, password, **extra_fields)
  30.    
  31. first_name="vorname_pruefer1",
  32.                                 last_name="nachname_pruefer1",
  33.                                 password='django_test',
  34.                                 email="test@web.de")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top