]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/forms/qanda.py
OSQA-678, be sure to call super in the clean method of the title field, otherwise...
[osqa.git] / forum / forms / qanda.py
index e107ad2f53691a118c24dc7c6447cfcd0080eb66..cd9fc7831da33ce1274df30324442b52b5b7839f 100644 (file)
@@ -5,8 +5,10 @@ from forum.models import *
 from django.utils.translation import ugettext as _
 from django.contrib.humanize.templatetags.humanize import apnumber
 
+from django.utils.encoding import smart_unicode
 from django.utils.safestring import mark_safe
 from general import NextUrlField, UserNameField, SetPasswordForm
+
 from forum import settings
 
 from forum.modules import call_all_handlers
@@ -24,6 +26,8 @@ class TitleField(forms.CharField):
         self.initial = ''
 
     def clean(self, value):
+        super(TitleField, self).clean(value);
+
         if len(value) < settings.FORM_MIN_QUESTION_TITLE:
             raise forms.ValidationError(_('title must be must be at least %s characters') % settings.FORM_MIN_QUESTION_TITLE)
 
@@ -213,7 +217,7 @@ class RevisionForm(forms.Form):
 
         date_format = '%c'
         self.fields['revision'].choices = [
-            (r[0], u'%s - %s (%s) %s' % (r[0], r[1], r[2].strftime(date_format), r[3]))
+            (r[0], u'%s - %s (%s) %s' % (r[0], smart_unicode(r[1]), r[2].strftime(date_format), r[3]))
             for r in revisions]
 
         self.fields['revision'].initial = post.active_revision.revision
@@ -296,8 +300,7 @@ class EditUserForm(forms.Form):
 
         if user.date_of_birth is not None:
             self.fields['birthday'].initial = user.date_of_birth
-        else:
-            self.fields['birthday'].initial = '1990-01-01'
+
         self.fields['about'].initial = user.about
         self.user = user