mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #24929 -- Allowed permission_required decorator to take any iterable
This commit is contained in:
parent
8b1f39a727
commit
39937de7e6
4 changed files with 22 additions and 2 deletions
|
@ -114,6 +114,10 @@ Minor features
|
|||
a deprecation warning in older versions and is no longer supported in
|
||||
Django 1.9).
|
||||
|
||||
* The permission argument of
|
||||
:func:`~django.contrib.auth.decorators.permission_required()` accepts all
|
||||
kinds of iterables, not only list and tuples.
|
||||
|
||||
:mod:`django.contrib.gis`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ The permission_required decorator
|
|||
(i.e. ``polls.can_vote`` for a permission on a model in the ``polls``
|
||||
application).
|
||||
|
||||
The decorator may also take a list of permissions.
|
||||
The decorator may also take an iterable of permissions.
|
||||
|
||||
Note that :func:`~django.contrib.auth.decorators.permission_required()`
|
||||
also takes an optional ``login_url`` parameter. Example::
|
||||
|
@ -599,6 +599,11 @@ The permission_required decorator
|
|||
(HTTP Forbidden) view<http_forbidden_view>` instead of redirecting to the
|
||||
login page.
|
||||
|
||||
.. versionchanged:: 1.9
|
||||
|
||||
In older versions, the ``permission`` parameter only worked with
|
||||
strings, lists, and tuples instead of strings and any iterable.
|
||||
|
||||
.. _applying-permissions-to-generic-views:
|
||||
|
||||
Applying permissions to generic views
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue