Skip to content

Conversation

@jbradberry
Copy link
Contributor

At some point in the recent past
(https://code.djangoproject.com/ticket/34977), Django changed the user edit form away from showing a link to the password change page, into a button. This relied on a call to get_context(), which this custom password widget wasn't invoking.

At some point in the recent past
(https://code.djangoproject.com/ticket/34977), Django changed the user
edit form away from showing a link to the password change page, into a
button.  This relied on a call to `get_context()`, which this custom
password widget wasn't invoking.
@jbradberry
Copy link
Contributor Author

old version:
Screenshot from 2025-09-26 16-36-09

new version:
Screenshot from 2025-09-26 16-39-29

@jbradberry
Copy link
Contributor Author

jbradberry commented Sep 26, 2025

The reason for the check for the presence of the 'value' key in the context['summary'] entries is because those are only populated when Django puts together the ugly hash, etc stuff when a valid password is set, e.g.:

[
  {'label': 'algorithm', 'value': 'pbkdf2_sha256'},
  {'label': 'iterations', 'value': 1000000},
  {'label': 'salt', 'value': 'HjmQxM****************'},
  {'label': 'hash', 'value': 'NCFBAA**************************************'}
]

ref: https://github.com/django/django/blob/5.2.5/django/contrib/auth/forms.py#L44-L59

@jbradberry jbradberry force-pushed the fix-admin-change-form-password-button branch 5 times, most recently from 4c9d1a2 to c2448f1 Compare September 29, 2025 14:58
This should work both for pre-5.0 and post-5.0 versions of Django.
@jbradberry jbradberry force-pushed the fix-admin-change-form-password-button branch from c2448f1 to 1019cc7 Compare September 29, 2025 15:00
@bgaudino bgaudino merged commit ddb85da into fusionbox:master Sep 29, 2025
30 checks passed
@jbradberry jbradberry deleted the fix-admin-change-form-password-button branch September 30, 2025 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants