Opened 9 years ago
Last modified 9 years ago
#24929 closed Cleanup/optimization
permission_required decorator should take any iterable of permissions — at Version 1
Reported by: | Raphael Michel | Owned by: | Raphael Michel |
---|---|---|---|
Component: | contrib.auth | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
As it came up in the discussion on ticket #24914 on GitHub (https://github.com/django/django/pull/4749#discussion_r31776720), there is no reason why permission_required only takes lists and tuples of permissions, while has_perms
itself can take any iterable. To be consistent with the new mixins and other parts of Django where both strings and iterables of strings are accepted (see e.g. model._meta.ordering), we should change this logic. I will prepare a pull request with the same logic that is used in other places.
Change History (1)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|---|
Has patch: | set |
Owner: | set to |
Status: | new → assigned |
Summary: | permission_required decorator should take any iterable if permissions → permission_required decorator should take any iterable of permissions |
I created the pull request: https://github.com/django/django/pull/4790