Verified Commit 79e16a6b authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Make sure username is present in form submit

parent d2b7e3d5
......@@ -38,7 +38,9 @@ class UserCreationForm(forms.ModelForm):
initial=True)
def clean(self):
self.cleaned_data['username'] = self.cleaned_data['username'].lower()
if 'username' in self.cleaned_data:
self.cleaned_data['username'] = (self.cleaned_data['username']
.lower())
super().clean()
def save(self, commit=True):
......@@ -78,5 +80,7 @@ class UserChangeForm(forms.ModelForm):
super().__init__(*args, **kwargs)
def clean(self):
self.cleaned_data['username'] = self.cleaned_data['username'].lower()
if 'username' in self.cleaned_data:
self.cleaned_data['username'] = (self.cleaned_data['username']
.lower())
super().clean()
......@@ -7,5 +7,7 @@ class AuthenticationForm(BaseAuthenticationForm):
super(AuthenticationForm, self).__init__(request, *args, **kwargs)
def clean(self):
self.cleaned_data['username'] = self.cleaned_data['username'].lower()
if 'username' in self.cleaned_data:
self.cleaned_data['username'] = (self.cleaned_data['username']
.lower())
super().clean()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment