The resulting pages are, however, visually inconsistent with the rest of
the admin.
Some examples:
1. Spacing is off.
2. No use of a `class="submit-row" ` css class which makes the button look
off.
3. Header is hardcoded to "Django administration" even though the rest of
the admin has a different branding (e.g., when set under
`admin.site.site_header`, `admin.site.site_title`, etc.).
4. The issues can be resolved here
https://github.com/django/django/tree/650ce967825aa192222391bfe3003c8d97e6f1d0/django/contrib/admin/templates/registration
(specifically only the `password_reset_` templates).
--
Ticket URL: <https://code.djangoproject.com/ticket/34677>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "Screenshot 2023-06-24 at 22.48.18.png" added.
* Attachment "Screenshot 2023-06-24 at 22.47.02.png" added.
* component: Uncategorized => contrib.admin
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:1>
Comment (by Andrew Northall):
The header issues are due to the fact that the view providing the password
reset functionality is not actually part of the admin site, so the
`site_header` context variable is never inserted and reverts to the
default.
This does seem like behaviour which should at least be mentioned in the
documentation. An 'easy' solution to this particular problem would be to
update the documentation to give the following example code, which will
ensure the correct site header is used in the views:
{{{#!python
from django.contrib import admin
admin.site.site_header = "My Admin Site"
urlpatterns = [
path(
"admin/password_reset/",
auth_views.PasswordResetView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="admin_password_reset",
),
path(
"admin/password_reset/done/",
auth_views.PasswordResetDoneView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="password_reset_done",
),
path(
"reset/<uidb64>/<token>/",
auth_views.PasswordResetConfirmView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="password_reset_confirm",
),
path(
"reset/done/",
auth_views.PasswordResetCompleteView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="password_reset_complete",
),
path("admin/", admin.site.urls),
]
}}}
The alternative solutions to the header issue do not seem practical.
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:2>
* owner: nobody => Priyank Panchal
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:3>
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Accepting considering I have reproduced the issue about lack of
consistency for admin site header/title and button CSS. I think the
solution for the former should be to update the docs, but do note that we
should provide a code snippet that sets all the relevant variables.
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:4>
Comment (by Natalia Bidart):
Is worth noting that the lack of `class="submit-row"` affects more than
one template, so all password reset related templates should be
audited/fixed.
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:5>
Comment (by Yaniv Toledano):
Replying to [comment:5 Natalia Bidart]:
> Is worth noting that the lack of `class="submit-row"` affects more than
one template, so all password reset related templates should be
audited/fixed.
Agree with this point. I believe the email input field is malformed as
well in comparison to the normal admin layouts.
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:6>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/17011 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:7>
* needs_better_patch: 1 => 0
Comment:
I'm happy for any guidance on what needs to be improved.
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:8>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1
Comment:
Priyank, please check
[https://code.djangoproject.com/ticket/34677#comment:4 comments].
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:9>
Comment (by funcy39):
The [https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-a
-password-reset-feature link] to the Django document and the version is
dev, but the ticket's version is 4.2. Which is the right version?
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:10>
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:11>
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:12>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:13>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:14>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"0016a4299569a8f09ff24053ff2b8224f7fa4113" 0016a429]:
{{{
#!CommitTicketReference repository=""
revision="0016a4299569a8f09ff24053ff2b8224f7fa4113"
Fixed #34677 -- Made admin password reset templates more consistent.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34677#comment:15>