Skip to content

User admin is broken in Django 6.0 #130

@jerivas

Description

@jerivas

django-authtools uses a custom UserForm to display a friendlier password field to users.

class UserChangeForm(DjangoUserChangeForm):
def __init__(self, *args, **kwargs):
super(UserChangeForm, self).__init__(*args, **kwargs)
password = self.fields.get('password')
if password:
password.widget = BetterReadOnlyPasswordHashWidget()

BetterReadOnlyPasswordHashWidget relies on context["summary"], but this was removed in Django 6.0. The result is that accessing a user detail page in the admin crashes the site:

/venv/lib/python3.13/site-packages/authtools/forms.py:37: in get_context
    if any(item.get('value') for item in context['summary']):
                                         ^^^^^^^^^^^^^^^^^^
E   KeyError: 'summary'

The workaround is to create a custom admin class for users that sets form=DjangoUserChangeForm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions