Creating the User and Superuser
Learn to implement the UserManager class for the User model to create a user and a superuser.
We'll cover the following...
We'll cover the following...
Let’s write UserManager so we can have methods to create a user and a superuser:
For the create_user method, we are basically making sure that fields such as password, email, username, first_name, and last_name are not None. If everything is good, we can confidently call the model, set a password, and save the user in the table.
This is done using the save() method.
The create_superuser method also behaves in accordance with the create_user method—this makes sense because, ...