Opened 5 years ago

Last modified 4 years ago

#30348 closed New feature

Add superuser_required decorator — at Version 2

Reported by: Sultan Iman Owned by:
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Sultan Iman)

Create a new decorator superuser_required and SuperuserRequiredMixin which has use cases when only super users can access certain views.
Github PR is at https://github.com/django/django/pull/10640

Change History (2)

comment:1 by Tobias Kunze, 5 years ago

Summing up the discussion on the GitHub PR here:

On the plus side, Django does provide very similar decorators and mixins, so it is surprising that superuser_required is not already a part of Django.

On the other hand, adding a decorator like this is trivial with user_passes_test. We could add a decorator like this to the user_passes_test documentation, to make sure searching for this (fairly reasonable) requirement yields helpful information.

comment:2 by Sultan Iman, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top