﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29270	KeyError if using 'password' as readonly_fields in UserAdmin	Malte Gerth	Malte Gerth	"If 'password' is added as readonly_field in UserAdmin, a KeyError is thrown, as the UserChangeForm expects a password field to exists.


{{{
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin

class UserAdmin(BaseUserAdmin):
    readonly_fields = ['username', 'password']

admin.site.register(User, UserAdmin)
}}}


{{{
class UserChangeForm(forms.ModelForm):
    # ...
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['password'].help_text = self.fields['password'].help_text.format('../password/')
        # ...
}}}
"	Bug	closed	contrib.auth	2.0	Normal	fixed			Accepted	0	0	0	0	1	0
