]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/forms.py
this will change the color of the number of answers to red.
[osqa.git] / forum / forms.py
index 2196981f6258c31e1c3ca373a7e45a66c0d4e2ce..c644b04253a0487289972dd7c656a348fc9aad78 100644 (file)
@@ -8,7 +8,7 @@ from forum.models import User
 
 from django.utils.safestring import mark_safe
 from forum.utils.forms import NextUrlField, UserNameField, SetPasswordForm
-from django.conf import settings
+from forum import settings
 import logging
 
 class TitleField(forms.CharField):
@@ -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