Fixed #35030 -- Made django.contrib.auth decorators to work with async functions.

This commit is contained in:
Dingning 2023-12-12 22:09:18 +08:00 committed by Mariusz Felisiak
parent 1fffa4af12
commit 549320946d
4 changed files with 287 additions and 18 deletions

View file

@ -617,6 +617,10 @@ The ``login_required`` decorator
:func:`django.contrib.admin.views.decorators.staff_member_required`
decorator a useful alternative to ``login_required()``.
.. versionchanged:: 5.1
Support for wrapping asynchronous view functions was added.
.. currentmodule:: django.contrib.auth.mixins
The ``LoginRequiredMixin`` mixin
@ -714,6 +718,11 @@ email in the desired domain and if not, redirects to the login page::
@user_passes_test(email_check, login_url="/login/")
def my_view(request): ...
.. versionchanged:: 5.1
Support for wrapping asynchronous view functions and using asynchronous
test callables was added.
.. currentmodule:: django.contrib.auth.mixins
.. class:: UserPassesTestMixin
@ -818,6 +827,10 @@ The ``permission_required`` decorator
``redirect_authenticated_user=True`` and the logged-in user doesn't have
all of the required permissions.
.. versionchanged:: 5.1
Support for wrapping asynchronous view functions was added.
.. currentmodule:: django.contrib.auth.mixins
The ``PermissionRequiredMixin`` mixin