djangorestframework-guardian
django-guardian support for Django REST Framework
What it is and what it does
djangorestframework-guardian bridges django-guardian's object-level permission system into Django REST Framework's API layer. It provides two main tools: ObjectPermissionsFilter, which restricts querysets to only objects a user has permission to view, and ObjectPermissionsAssignmentMixin, which automatically assigns permissions to users or groups when objects are created or updated via serializers.
The package is designed for applications that need granular, per-object access control in REST APIs—where different users should see and modify different subsets of the same model. It requires django-guardian to be configured with its ObjectPermissionBackend and works alongside custom permission classes that map HTTP methods to specific permission names.
Use it for:
- Multi-tenant SaaS APIs where each user should only see and modify their own data or shared resources.
- Collaborative platforms where permissions are assigned per-object to users and groups dynamically.
- Admin dashboards that expose REST endpoints with row-level security based on object permissions.
- Workflows where creating a resource automatically grants specific permissions to the creator and designated groups.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates django-guardian's object-level permissions into Django REST Framework, enabling fine-grained access control on API resources through filtering and automatic permission assignment.
Yes, if you are building a Django REST Framework API that requires object-level permissions beyond Django's standard model-level checks. The package is stable (Production/Stable status), has no known vulnerabilities, and low install friction. However, maintenance is infrequent (409 days since last release), so verify it works with your specific Django and djangorestframework versions before committing to it in a new project.
Install
djangorestframework-guardian on PyPI
pip
pip install djangorestframework-guardianuv
uv add djangorestframework-guardianpoetry
poetry add djangorestframework-guardianInstalling djangorestframework-guardian
Before you install
Low friction: pure Python wheel with three straightforward dependencies (django, djangorestframework, django-guardian). Last release 2025-07-01; repository active and not archived, though 409 days since last release suggests maintenance is infrequent.
License in practice
BSD-3-Clause (permissive): you may use, modify, and distribute this package freely in commercial and open-source projects, provided you include the license notice.
Quickstart
pip install djangorestframework-guardian
from djangorestframework_guardian import filters
class MyViewSet:
filter_backends = [filters.ObjectPermissionsFilter]
django-guardian and djangorestframework must be installed and configured in INSTALLED_APPS and AUTHENTICATION_BACKENDS before this package's filters will function.
Verify before relying
- Whether ObjectPermissionsFilter works correctly with all Django REST Framework view types and pagination strategies.
- Performance characteristics when filtering large querysets with many object-level permissions.
- Compatibility with custom user models or non-standard permission backends.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — django, djangorestframework, django-guardian |
| Maintenance | aging — 409 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 160,532/month — #10,658 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: djangorestframework_guardian-0.4.0-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-guardiandjango-guardian adds per-object permission…
permissive · top 5,000 on PyPI
dry-rest-permissionsDefines rules-based permissions for Django REST…
permissive · top 15,000 on PyPI
bridgekeeperBridgekeeper provides a permissions system for…
permissive · top 15,000 on PyPI
djangorestframework-role-filtersAdds role-based access control to Django REST…
permissive · top 5,000 on PyPI
rest_conditionProvides logical operators (And, Or, Not) to…
permissive · top 15,000 on PyPI
djangorestframeworkBuilds web APIs on top of Django with…
permissive · top 1,000 on PyPI
django-permissionedformsExtends Django's forms framework to…
permissive · top 5,000 on PyPI
djangorestframework-filtersExtends Django REST Framework with advanced…
permissive · top 15,000 on PyPI
oschmodSets file permissions consistently across…
permissive · top 15,000 on PyPI
django-prbacImplements parameterized role-based access…
unclear · top 15,000 on PyPI