Opened 17 months ago
Closed 16 months ago
#34677 closed Cleanup/optimization (fixed)
Django Admin built-in password reset feature has UI issues
Reported by: | Yaniv Toledano | Owned by: | Priyank Panchal |
---|---|---|---|
Component: | contrib.admin | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | yes |
Description
The documentation refers to adding password reset features to the admin site here: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-a-password-reset-feature.
The resulting pages are, however, visually inconsistent with the rest of the admin.
Some examples:
- Spacing is off.
- No use of a
class="submit-row"
css class which makes the button look off. - 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.). - The issues can be resolved here https://github.com/django/django/tree/650ce967825aa192222391bfe3003c8d97e6f1d0/django/contrib/admin/templates/registration (specifically only the
password_reset_
templates).
Attachments (2)
Change History (17)
by , 17 months ago
Attachment: | Screenshot 2023-06-24 at 22.48.18.png added |
---|
by , 17 months ago
Attachment: | Screenshot 2023-06-24 at 22.47.02.png added |
---|
comment:1 by , 17 months ago
Component: | Uncategorized → contrib.admin |
---|
comment:3 by , 17 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 17 months ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Bug → Cleanup/optimization |
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.
follow-up: 6 comment:5 by , 17 months ago
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.
comment:6 by , 17 months ago
Replying to 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.
comment:8 by , 17 months ago
Patch needs improvement: | unset |
---|
I'm happy for any guidance on what needs to be improved.
comment:9 by , 17 months ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Priyank, please check comments.
comment:10 by , 17 months ago
The link to the Django document and the version is dev, but the ticket's version is 4.2. Which is the right version?
comment:11 by , 16 months ago
Needs documentation: | unset |
---|
comment:12 by , 16 months ago
Needs tests: | unset |
---|
comment:13 by , 16 months ago
Patch needs improvement: | unset |
---|
comment:14 by , 16 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
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:
The alternative solutions to the header issue (refactoring class based views or the admin site) seem overly complex.
I'd be happy to work on this documentation based solution (and the CSS) if there is consensus on it.