← Back to Django Course | Chapter 8: Django Admin | Lesson 8 of 8

Admin Permissions

Admin permissions decide which staff users are allowed to view, add, change, or delete each type of record.

The Four Default Permissions

For every model Django registers, it automatically creates add, change, delete, and view permissions. A staff user needs the relevant one to perform that action in the admin.

Example: The Four Default Permissions

Lists the four auto-created permissions for a Book model.

bash
python manage.py shell
>>> from django.contrib.auth.models import Permission
>>> Permission.objects.filter(content_type__model='book')
<QuerySet [<Permission: core | book | Can add book>, <Permission: core | book | Can change book>, ...]>

⚠️ Run this command in your terminal.

Assigning Permissions Directly to a User

A staff user (is_staff=True) with no permissions sees an empty admin. Permissions must be granted explicitly, either individually or through a group.

Example: Assigning Permissions Directly to a User

Grants the editor user permission to change Book records in the admin.

bash
python manage.py shell
>>> from django.contrib.auth.models import User, Permission
>>> user = User.objects.get(username='editor')
>>> perm = Permission.objects.get(codename='change_book')
>>> user.user_permissions.add(perm)

⚠️ Run this command in your terminal.

Using Groups for Bulk Permissions

Instead of assigning permissions one user at a time, create a Group with the right permissions and add users to it -- much easier to manage as your team grows.

Warning: is_superuser overrides all of this: a superuser can do everything regardless of assigned permissions or group membership.

Example: Using Groups for Bulk Permissions

Creates an Editors group with the change_book permission and adds the user to it.

bash
python manage.py shell
>>> from django.contrib.auth.models import Group
>>> editors = Group.objects.create(name='Editors')
>>> editors.permissions.add(perm)
>>> user.groups.add(editors)

⚠️ Run this command in your terminal.

Common Mistakes
  1. Giving a user is_staff=True without any specific permissions, then being confused why they see an empty admin with nothing to manage.
  2. Confusing is_staff (can log in to /admin/) with is_superuser (bypasses all permission checks).
  3. Forgetting that permissions can be granted individually or in bulk through Groups, not just per-user.
Chapter Summary
  • Every model gets four automatic permissions: add, change, delete, and view.
  • is_staff allows admin login; individual permissions decide what a staff user can actually do there.
  • Groups bundle permissions together so they can be assigned to many users at once.
  • is_superuser bypasses all permission checks entirely.

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.