Complete the code to import the Group model from Django's auth module.
from django.contrib.auth.models import [1]
The Group model is imported from django.contrib.auth.models to manage group-based permissions.
Complete the code to create a new group named 'Editors'.
new_group = Group.objects.[1](name='Editors')
The create method creates and saves a new group with the given name.
Fix the error in the code to add a user to a group.
user.groups.[1](group)The add method is used to add a group to the user's groups many-to-many relation.
Fill both blanks to check if a user belongs to the 'Admins' group.
if user.groups.filter(name=[1]).[2](): print('User is an admin')
The filter method filters groups by name, and exists() checks if any such group exists for the user.
Fill all three blanks to assign the 'change_article' permission to the 'Editors' group.
permission = Permission.objects.get(codename=[1]) group = Group.objects.get(name=[2]) group.permissions.[3](permission)
We get the permission by its codename, get the group by name, then add the permission to the group's permissions.