Complete the code to import the Django permission model.
from django.contrib.auth.models import [1]
The Permission model is used to manage built-in permissions in Django.
Complete the code to check if a user has a specific permission.
if user.[1]('app_label.permission_codename'):
The has_perm method checks if a user has a given permission string.
Fix the error in the code to assign a permission to a user.
permission = Permission.objects.get(codename='add_article') user.user_permissions.[1](permission)
The add method adds a permission to the user's permissions.
Fill both blanks to create a dictionary comprehension of permissions with their names.
{perm.[1]: perm.[2] for perm in Permission.objects.all()}The codename is the key and name is the value for permissions.
Fill all three blanks to filter permissions for a specific app and order by name.
permissions = Permission.objects.filter(content_type__app_label=[1]).order_by([2]).values_list([3], flat=True)
Filter by app label 'blog', order by 'name', and get list of 'codename's.
