Fixed #27136 -- Changed auth forms' autofocus attribute to HTML5 boolean syntax.

This commit is contained in:
Jon Dufresne 2016-08-28 17:19:50 -07:00 committed by GitHub
parent 38cf9ef390
commit ae98d40c35
1 changed files with 4 additions and 4 deletions

View File

@ -95,7 +95,7 @@ class UserCreationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(UserCreationForm, self).__init__(*args, **kwargs)
if self._meta.model.USERNAME_FIELD in self.fields:
self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update({'autofocus': ''})
self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update({'autofocus': True})
def clean_password2(self):
password1 = self.cleaned_data.get("password1")
@ -152,7 +152,7 @@ class AuthenticationForm(forms.Form):
"""
username = UsernameField(
max_length=254,
widget=forms.TextInput(attrs={'autofocus': ''}),
widget=forms.TextInput(attrs={'autofocus': True}),
)
password = forms.CharField(
label=_("Password"),
@ -347,7 +347,7 @@ class PasswordChangeForm(SetPasswordForm):
old_password = forms.CharField(
label=_("Old password"),
strip=False,
widget=forms.PasswordInput(attrs={'autofocus': ''}),
widget=forms.PasswordInput(attrs={'autofocus': True}),
)
field_order = ['old_password', 'new_password1', 'new_password2']
@ -375,7 +375,7 @@ class AdminPasswordChangeForm(forms.Form):
required_css_class = 'required'
password1 = forms.CharField(
label=_("Password"),
widget=forms.PasswordInput(attrs={'autofocus': ''}),
widget=forms.PasswordInput(attrs={'autofocus': True}),
strip=False,
help_text=password_validation.password_validators_help_text_html(),
)