Adds per-object permissions to Django's authorization system, enabling fine-grained access control.
django-guardian is a Django package that implements per-object permissions, extending Django's standard model-level permissions to allow fine-grained access control on individual database objects. It solves the problem of needing to restrict user actions on specific instances, such as allowing a user to edit only their own blog posts.
Django developers building applications that require complex, instance-level access control, such as multi-tenant systems, content management platforms, or enterprise software.
Developers choose django-guardian because it integrates seamlessly with Django's existing permission system, is well-documented, widely used in production, and provides a straightforward API for managing object-level permissions without reinventing the wheel.
Per object permissions for Django
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables per-object permissions on individual model instances, as shown in the README with examples like assigning 'change_group' to specific users, solving complex access needs beyond Django's default model-level permissions.
Provides GuardedModelAdmin to manage object permissions directly in Django admin, replacing admin.ModelAdmin easily, which simplifies administrative workflows for permission management.
Integrates out-of-the-box with django-unfold for a modern admin interface, as noted in the README, ensuring better user experience without extra configuration.
Offers comprehensive online documentation and is used by thousands of projects worldwide, indicating reliability and good support, with high test coverage (97.8%) ensuring stability.
Checking permissions on individual objects requires additional database queries, which can slow down applications with many permission checks, especially in large-scale systems.
Requires modifying Django's AUTHENTICATION_BACKENDS and INSTALLED_APPS, which might conflict with custom backends or existing authentication setups, adding complexity to project configuration.
Tightly coupled with Django's ORM, making it less suitable for applications using raw SQL, non-relational databases, or alternative data access layers without Django models.