mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Fixed #26381 -- Made UserCreationForm reusable with custom user models that define USERNAME_FIELD.
This commit is contained in:
committed by
Tim Graham
parent
2b31f14d89
commit
efa9539787
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user