Within the Django file /django/contrib/auth/models.py
, in the class class UserManager(BaseUserManager):
, have inserted the prints as seen below .
Now creating new users - nothing gets printed in the terminal . My Question - Why wont the email and username print into the terminal ? Is the _create_user
method not being used , when creating a new user?
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, username, email, password, **extra_fields):
"""
Create and save a user with the given username, email, and password.
"""
print("--PlaceHolder----") # Doesnt Print in Terminal
if not username:
raise ValueError('The given username must be set')
email = self.normalize_email(email)
print(email) # Doesnt Print in Terminal
username = self.model.normalize_username(username)
print(username) # Doesnt Print in Terminal
I understand that the class class UserManager(BaseUserManager)
is being called with the line of code objects = UserManager()
within the class class AbstractUser(AbstractBaseUser, PermissionsMixin):
, in the same file .
This question is a follow-up to my earlier question here - Django - UserModel - How to create Custom Text Field within the django/contrib/auth/forms.py
*EDIT -1- * Also - i do understand that the create_user method internally calls the _create_user method .