Opened 7 years ago
Last modified 5 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 )
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 , 7 years ago
comment:2 by , 7 years ago
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.
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_requiredis 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 theuser_passes_testdocumentation, to make sure searching for this (fairly reasonable) requirement yields helpful information.