skillfed

django-guardian

Per object permissions for Django

django-guardian v3.3.3 1.1M downloads/30d#4,395 on PyPI3,910
Permissive license BSD-2-Clause Active released

What it is and what it does

django-guardian extends Django's built-in permission system to support per-object (row-level) access control. Instead of granting a user permission to change all instances of a model, you can grant permission to change a specific instance. It works by adding an extra authentication backend and database tables to track object-level grants for users and groups.

The package integrates directly into Django's permission checking—you use the same `has_perm()` method but pass an object instance as a third argument. It also provides admin integration through `GuardedModelAdmin` so you can manage object permissions in the Django admin panel. The library is widely used in production and supports modern Django versions (3.2–5.2) and Python 3.10+.

Use it for:

  • Grant specific team members access to edit only their own projects or documents in a multi-tenant app.
  • Implement row-level security where users can only view/modify records they own or have been assigned.
  • Build admin panels where staff can manage permissions for individual model instances without code changes.
  • Control access to sensitive objects (e.g., reports, files) on a per-user or per-group basis within a single model.
  • Enforce organizational hierarchies where managers can only access records for their department or team.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

django-guardian adds per-object permission checks to Django, letting you grant or deny specific users and groups access to individual model instances rather than just model-wide permissions.

Yes. django-guardian is a mature, actively maintained library with no known vulnerabilities, low install friction, and permissive licensing. It solves a real problem—per-object permissions—that Django's built-in system does not address. Use it when you need fine-grained access control beyond model-level permissions.

Install

django-guardian on PyPI

pip

pip install django-guardian

uv

uv add django-guardian

poetry

poetry add django-guardian

Installing django-guardian

Before you install

Low friction install with only django and typing_extensions as runtime dependencies. The package is actively maintained with a recent release (23 days old) and has been stable since its early releases, supporting Django 3.2 through 5.2 and Python 3.10–3.14.

License in practice

BSD-2-Clause is permissive, allowing commercial use, modification, and distribution with minimal restrictions—suitable for most projects.

Quickstart

pip install django-guardian

# In settings.py:
INSTALLED_APPS = (..., 'guardian')
AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'guardian.backends.ObjectPermissionBackend',
)

# Then:
from guardian.shortcuts import assign_perm
assign_perm('change_group', user, obj=group_instance)

Requires running `python manage.py migrate` to create guardian database tables after installation.

Verify before relying

  • Performance impact when checking permissions on large numbers of objects or users.
  • Compatibility with custom authentication backends beyond those documented.

Package facts

License BSD-2-Clause (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — django, typing_extensions
Maintenance actively maintained — 23 days since the last release
Last repo commit
First released
Downloads 1,082,111/month — #4,395 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_guardian-3.3.3-py3-none-any.whl

Keywords: django, permissions, authorization, object, row, level

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 3.2Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: SecurityTopic :: Software Development :: Libraries :: Python Modules

Tags

django per-object permissionsrow-level access control djangoobject-level authorizationdjango instance permissionsfine-grained django permissionsdjango object permissions backenddjango row permissions
authorizationrow-level-securitydjango-extension

More Python Modules packages