pypi / django-guardian
django-guardian
What changed in django-guardian 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-25.
3 breaking1 deprecations1 new APIs and options1 performance1 behavior and defaults3 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initdjango-guardian 310 changes
Breaking changes 3
With accept_global_perms=True, the global permission check now uses any() when any_perm is set, so holding one required permission globally can grant access.
Global permissions are now filtered by the queried model's content type, preventing permissions on another model with the same codename from granting access to its objects.
With any_perm=False, objects are returned only when the user holds every remaining requested permission, directly or through their groups.
Deprecations 1
Set this to True to restore pre-3.5.1 behavior temporarily; it defaults to False, emits a DeprecationWarning on affected calls, and will be removed in 3.6.0.
New APIs and options 1
Adds async support to PermissionRequiredMixin.
Performance 1
The backend now uses get_anonymous_user(), applying GUARDIAN_ANONYMOUS_USER_CACHE_TTL and avoiding a database lookup on every anonymous has_perm() or get_all_permissions() call.
Behavior and default changes 1
Adds get_objects_for_user filtering to GuardedModelAdminMixin.
Fixes and other changes 3
Batched cleanup continues from the last seen primary key so deleting orphans no longer causes rows or the final partial group batch to be skipped; resume hints no longer skip rows.
With GUARDIAN_AUTO_PREFETCH enabled, active superusers now get every permission for the object's content type; the shortcut and get_obj_perms template tag are fixed too.
Dispatch LoginRequiredMixin asynchronously for asynchronous views.