Creates and saves a User with the given email and password.
(self, email, date_of_birth, password=None, **fields)
| 15 | # changes in username datatype, and non-text required fields. |
| 16 | class CustomUserManager(BaseUserManager): |
| 17 | def create_user(self, email, date_of_birth, password=None, **fields): |
| 18 | """ |
| 19 | Creates and saves a User with the given email and password. |
| 20 | """ |
| 21 | if not email: |
| 22 | raise ValueError("Users must have an email address") |
| 23 | |
| 24 | user = self.model( |
| 25 | email=self.normalize_email(email), date_of_birth=date_of_birth, **fields |
| 26 | ) |
| 27 | |
| 28 | user.set_password(password) |
| 29 | user.save(using=self._db) |
| 30 | return user |
| 31 | |
| 32 | async def acreate_user(self, email, date_of_birth, password=None, **fields): |
| 33 | """See create_user()""" |