mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[5.1.x] Refs #31405 -- Improved LoginRequiredMiddleware documentation.
co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Backport of 49815f70e4 from main.
This commit is contained in:
committed by
Sarah Boyce
parent
d9aeb23edb
commit
291fa5fbbe
@@ -91,12 +91,15 @@ redirects all unauthenticated requests to a login page. Views can allow
|
||||
unauthenticated requests by using the new
|
||||
:func:`~django.contrib.auth.decorators.login_not_required` decorator.
|
||||
|
||||
The :class:`~django.contrib.auth.middleware.LoginRequiredMiddleware` respects
|
||||
the ``login_url`` and ``redirect_field_name`` values set via the
|
||||
``LoginRequiredMiddleware`` respects the ``login_url`` and
|
||||
``redirect_field_name`` values set via the
|
||||
:func:`~.django.contrib.auth.decorators.login_required` decorator, but does not
|
||||
support setting ``login_url`` or ``redirect_field_name`` via the
|
||||
:class:`~django.contrib.auth.mixins.LoginRequiredMixin`.
|
||||
|
||||
To enable this, add ``"django.contrib.auth.middleware.LoginRequiredMiddleware"``
|
||||
to your :setting:`MIDDLEWARE` setting.
|
||||
|
||||
Minor features
|
||||
--------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user