Complete the code to import the default User model in Django.
from django.contrib.auth.models import [1]
The default User model in Django is named User and is imported from django.contrib.auth.models.
Complete the code to create a new User instance with username 'alice'.
user = User.objects.[1](username='alice')
To create a new User instance in Django, use create() on the model manager.
Fix the error in the code to check if a user is staff.
if user.[1]: print('User is staff')
The correct attribute to check if a user is staff is is_staff.
Fill both blanks to filter users who are active and have email ending with '@example.com'.
users = User.objects.filter(is_active=[1], email__[2]='@example.com')
To filter active users, use is_active=True. To filter emails ending with a string, use email__endswith.
Fill all three blanks to update a user's first name and save the changes.
user = User.objects.get(username=[1]) user.first_name = [2] user.[3]()
Get the user by username 'alice', set first_name to 'Alice', then call save() to save changes.