diff --git a/colab/accounts/forms.py b/colab/accounts/forms.py index c871a94..bc5f402 100644 --- a/colab/accounts/forms.py +++ b/colab/accounts/forms.py @@ -32,7 +32,7 @@ class UserForm(forms.ModelForm): # Forces username to be lowercase always widget=forms.TextInput(attrs={'style' : 'text-transform: lowercase;'}), ) - required = ('first_name', 'last_name', 'email', 'username') + required = ('first_name', 'last_name', 'username') class Meta: model = User @@ -49,35 +49,17 @@ class UserForm(forms.ModelForm): class UserCreationForm(UserForm): - email = forms.EmailField( - - # Forces email to be a read-only field - widget=forms.TextInput(attrs={'readonly': 'readonly'}) - ) - - def __init__(self, *args, **kwargs): - self.original_email = kwargs.pop('email', None) - super(UserCreationForm, self).__init__(*args, **kwargs) - - def clean_email(self): - form_email = self.cleaned_data['email'] - - if form_email != self.original_email: - raise forms.ValidationError('This is not the original email.') - - return form_email - def clean_username(self): username = self.cleaned_data['username'] username = username.strip() if not username: - raise forms.ValidationError('This field should not be blank.') + raise forms.ValidationError(_('This field should not be blank.')) return username class Meta: model = User - fields = ('first_name', 'last_name', 'email', 'username') + fields = ('first_name', 'last_name', 'username') class UserUpdateForm(UserForm): diff --git a/colab/accounts/views.py b/colab/accounts/views.py index 3ad7aa3..b18b17f 100644 --- a/colab/accounts/views.py +++ b/colab/accounts/views.py @@ -138,8 +138,6 @@ def signup(request): user_form = UserCreationForm() lists_form = ListsForm() - user_form.fields['email'].initial = user.email - return render(request, 'accounts/user_create_form.html', {'user_form': user_form, 'lists_form': lists_form}) @@ -152,8 +150,7 @@ def signup(request): user = user_form.save(commit=False) user.needs_update = False - update_fields = ['first_name', 'last_name', 'username', 'needs_update'] - user.save(update_fields=update_fields) + user.save() # Check if the user's email have been used previously # in the mainling lists to link the user to old messages -- libgit2 0.21.2