diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/auth/forms.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index 4485e1fb14..171fa1fb41 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -82,7 +82,7 @@ class UserCreationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(UserCreationForm, self).__init__(*args, **kwargs) - self.fields['username'].widget.attrs.update({'autofocus': ''}) + self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update({'autofocus': ''}) def clean_password2(self): password1 = self.cleaned_data.get("password1") |
