The default User model in Django uses the username field as the unique identifier for authentication.
from django.contrib.auth.models import User
user = User.objects.create_user('alice', 'alice@example.com', 'password123')
print(user.is_staff)What will be printed?
from django.contrib.auth.models import User user = User.objects.create_user('alice', 'alice@example.com', 'password123') print(user.is_staff)
By default, is_staff is set to False for users created with create_user.
Option D correctly sets USERNAME_FIELD as a string and returns self.email (an attribute) in __str__.
Option D misses quotes around 'email'.
Option D returns email which is undefined in the method scope.
Option D calls self.email() as a method, but it's a field.
Django raises a ValueError if USERNAME_FIELD is not set in a custom user model.
AbstractUser is a full user model with username, email, and other fields already defined. You can extend it easily.
AbstractBaseUser provides only the core authentication features like password and last login, so you must define all other fields and methods yourself.