mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.10.x] Fixed #27111 -- Fixed KeyError if USERNAME_FIELD isn't in UserCreationForm.fields.
Backport of 3c18f8a3d2 from master
This commit is contained in:
committed by
Tim Graham
parent
6f006f40f7
commit
c4ee93128f
@@ -94,7 +94,8 @@ class UserCreationForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(UserCreationForm, self).__init__(*args, **kwargs)
|
||||
self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update({'autofocus': ''})
|
||||
if self._meta.model.USERNAME_FIELD in self.fields:
|
||||
self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update({'autofocus': ''})
|
||||
|
||||
def clean_password2(self):
|
||||
password1 = self.cleaned_data.get("password1")
|
||||
|
||||
Reference in New Issue
Block a user