Opened 6 weeks ago
Last modified 9 hours ago
#35670 assigned Cleanup/optimization
Unclear docs for LoginRequiredMiddleware.get_login_url()
Reported by: | Claude Paroz | Owned by: | Aditya Chaudhary |
---|---|---|---|
Component: | Documentation | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
I'm struggling to understand the second sentence of the documentation of LoginRequiredMiddleware.get_login_url() (https://docs.djangoproject.com/en/5.1/ref/middleware/#django.contrib.auth.middleware.get_login_url).
If defined, this returns the login_url set on the login_required() decorator. Defaults to settings.LOGIN_URL.
After many reads, I think I get the point of the If defined
that means if the login_required() defines login_url, then... I'm sure we can do better. Same issue with the docs for
get_redirect_field_name()` below.
Change History (6)
comment:1 by , 6 weeks ago
comment:2 by , 6 weeks ago
Triage Stage: | Unreviewed → Accepted |
---|
Agreed this could be worded better.
If ``login_url`` is set on the :func:`~.django.contrib.auth.decorators.login_required` decorator, this is returned. Otherwise, returns :setting:`settings.LOGIN_URL <LOGIN_URL>`.
(as another option)
comment:3 by , 6 weeks ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:4 by , 2 days ago
@Samruddhi Dharankar, are you still working in this issue ?
Or shall I assign this to myself ?
comment:5 by , 24 hours ago
Owner: | changed from | to
---|
Maybe something like: "By default, it returns either a
login_url
attribute set on the view by alogin_required
decorator, orsettings.LOGIN_URL
."