Commit 5008375bf23dcbdbaffab6f0a9e629c7049d6e93
Committed by
Sergio Oliveira
1 parent
d6414cc4
Exists in
master
and in
39 other branches
Flake8 accounts
Showing
1 changed file
with
11 additions
and
11 deletions
Show diff stats
colab/accounts/forms.py
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | 2 | ||
3 | from collections import OrderedDict | 3 | from collections import OrderedDict |
4 | 4 | ||
5 | -from django.http import HttpRequest | ||
6 | from django import forms | 5 | from django import forms |
7 | from django.contrib.auth import authenticate, get_user_model | 6 | from django.contrib.auth import authenticate, get_user_model |
8 | from django.contrib.auth.forms import ReadOnlyPasswordHashField | 7 | from django.contrib.auth.forms import ReadOnlyPasswordHashField |
@@ -61,19 +60,19 @@ class UserForm(forms.ModelForm): | @@ -61,19 +60,19 @@ class UserForm(forms.ModelForm): | ||
61 | if not username: | 60 | if not username: |
62 | raise forms.ValidationError(_('This field cannot be blank.')) | 61 | raise forms.ValidationError(_('This field cannot be blank.')) |
63 | return username | 62 | return username |
64 | - | 63 | + |
65 | def clean_first_name(self): | 64 | def clean_first_name(self): |
66 | - first_name = self.cleaned_data["first_name"].strip() | 65 | + first_name = self.cleaned_data["first_name"].strip() |
67 | if not first_name: | 66 | if not first_name: |
68 | raise forms.ValidationError(_('This field cannot be blank.')) | 67 | raise forms.ValidationError(_('This field cannot be blank.')) |
69 | return first_name | 68 | return first_name |
70 | - | 69 | + |
71 | def clean_last_name(self): | 70 | def clean_last_name(self): |
72 | last_name = self.cleaned_data["last_name"].strip() | 71 | last_name = self.cleaned_data["last_name"].strip() |
73 | if not last_name: | 72 | if not last_name: |
74 | raise forms.ValidationError(_('This field cannot be blank.')) | 73 | raise forms.ValidationError(_('This field cannot be blank.')) |
75 | return last_name | 74 | return last_name |
76 | - | 75 | + |
77 | def clean_twitter(self): | 76 | def clean_twitter(self): |
78 | twitter = self.cleaned_data["twitter"] | 77 | twitter = self.cleaned_data["twitter"] |
79 | if twitter is not None and twitter.isspace(): | 78 | if twitter is not None and twitter.isspace(): |
@@ -89,11 +88,11 @@ class UserForm(forms.ModelForm): | @@ -89,11 +88,11 @@ class UserForm(forms.ModelForm): | ||
89 | def clean_webpage(self): | 88 | def clean_webpage(self): |
90 | webpage = self.cleaned_data["webpage"].strip() | 89 | webpage = self.cleaned_data["webpage"].strip() |
91 | return webpage | 90 | return webpage |
92 | - | 91 | + |
93 | def clean_role(self): | 92 | def clean_role(self): |
94 | role = self.cleaned_data["role"].strip() | 93 | role = self.cleaned_data["role"].strip() |
95 | - return role | ||
96 | - | 94 | + return role |
95 | + | ||
97 | def clean_institution(self): | 96 | def clean_institution(self): |
98 | institution = self.cleaned_data["institution"].strip() | 97 | institution = self.cleaned_data["institution"].strip() |
99 | return institution | 98 | return institution |
@@ -101,11 +100,12 @@ class UserForm(forms.ModelForm): | @@ -101,11 +100,12 @@ class UserForm(forms.ModelForm): | ||
101 | def clean_bio(self): | 100 | def clean_bio(self): |
102 | bio = self.cleaned_data["bio"].strip() | 101 | bio = self.cleaned_data["bio"].strip() |
103 | return bio | 102 | return bio |
104 | - | 103 | + |
105 | def clean_github(self): | 104 | def clean_github(self): |
106 | github = self.cleaned_data["github"].strip() | 105 | github = self.cleaned_data["github"].strip() |
107 | - return github | ||
108 | - | 106 | + return github |
107 | + | ||
108 | + | ||
109 | class UserUpdateForm(UserForm): | 109 | class UserUpdateForm(UserForm): |
110 | bio = forms.CharField( | 110 | bio = forms.CharField( |
111 | widget=forms.Textarea(attrs={'rows': '6', 'maxlength': '200'}), | 111 | widget=forms.Textarea(attrs={'rows': '6', 'maxlength': '200'}), |