From b40a66a512f018ca056f96c79cd7bf4ed05a83ce Mon Sep 17 00:00:00 2001 From: Kriti Godey Date: Thu, 22 Apr 2010 17:04:45 -0400 Subject: [PATCH] Editing user settings seems to work. --- forms.py | 8 ++++---- views.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/forms.py b/forms.py index e79669c..aa86e0d 100644 --- a/forms.py +++ b/forms.py @@ -25,11 +25,11 @@ class NewUserForm(forms.Form): email = forms.EmailField() username = forms.CharField() password = forms.CharField(widget=forms.PasswordInput) - confirmpassword = forms.CharField(widget=forms.PasswordInput) + confirmpassword = forms.CharField(label=("Confirm password"), widget=forms.PasswordInput) - def clean_mpassword(self): + def clean_confirmpassword(self): password = self.cleaned_data.get("password", "") cpassword = self.cleaned_data["confirmpassword"] if password != cpassword: - raise forms.ValidationError(_("The two password fields didn't match.")) - return cpassword + raise forms.ValidationError(("The two password fields didn't match.")) + return cpassword diff --git a/views.py b/views.py index 1fd9137..fde9e56 100644 --- a/views.py +++ b/views.py @@ -205,6 +205,8 @@ def edit_user(request, gusername): guser.email = email guser.save() return render_to_response('userchanged.html', context_instance=RequestContext(request)) + else: + return render_to_response('edituser.html', {'cform': form,}, context_instance=RequestContext(request)) else: form = NewUserForm(initial={'username': guser.username, 'first_name': guser.first_name, 'last_name': guser.last_name, 'email': guser.email, }) # An unbound form return render_to_response('edituser.html', {'cform': form,}, context_instance=RequestContext(request)) -- 2.20.1