]> git.openstreetmap.org Git - osqa.git/commitdiff
Besides making an option to make usernames to be editable, is also good that users...
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 13 May 2010 01:43:19 +0000 (01:43 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 13 May 2010 01:43:19 +0000 (01:43 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@249 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/forms.py
forum/skins/default/templates/users/edit.html

index 978ef175eeed03a60e5d47c44c81f78e9e3efe43..c644b04253a0487289972dd7c656a348fc9aad78 100644 (file)
@@ -188,8 +188,6 @@ class EditAnswerForm(forms.Form):
 
 class EditUserForm(forms.Form):
     email = forms.EmailField(label=u'Email', help_text=_('this email does not have to be linked to gravatar'), required=True, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
-    if settings.EDITABLE_SCREEN_NAME:
-       username = UserNameField(label=_('Screen name'))
     realname = forms.CharField(label=_('Real name'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
     website = forms.URLField(label=_('Website'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
     city = forms.CharField(label=_('Location'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
@@ -198,8 +196,8 @@ class EditUserForm(forms.Form):
 
     def __init__(self, user, *args, **kwargs):
         super(EditUserForm, self).__init__(*args, **kwargs)
-        logging.debug('initializing the form')
         if settings.EDITABLE_SCREEN_NAME:
+            self.fields['username'] = UserNameField(label=_('Screen name'))
             self.fields['username'].initial = user.username
             self.fields['username'].user_instance = user
         self.fields['email'].initial = user.email
index b3a7e74b68d14bb45710dfa6ccd17c58c9516de3..bdd0921ecc49cc761b8c276d8008e19981fd76f3 100644 (file)
                 </tr>\r
                 <tr style="height:35px">\r
                        <td>{% trans "Screen Name" %}:</td>\r
-                       <td>{{ request.user.username }} <span class="form-error"></span> {{ form.username.errors }} </td>\r
+                       <td>\r
+                       {% if form.username %}\r
+                           {{ form.username }} <span class="form-error"></span> {{ form.username.errors }}\r
+                       {% else %}\r
+                           {{ request.user.username }}\r
+                       {% endif %}\r
+                       </td>\r
                    </tr>\r
                 \r
                    <tr style="height:35px">\r