]> git.openstreetmap.org Git - osqa.git/commitdiff
Fixes a problem with a widget that was causing weird rendering of comma separated...
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 22 Jun 2010 23:39:54 +0000 (23:39 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 22 Jun 2010 23:39:54 +0000 (23:39 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@442 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/settings/forms.py

index b4a93e62660f9b4d8e55533561c1d2e8390d0fc9..0c123011cbc99976a71a9107eba0f50a858fd850 100644 (file)
@@ -25,7 +25,9 @@ class SettingsSetForm(forms.Form):
         for setting in set:
             widget = setting.field_context.get('widget', None)
 
-            if widget is forms.RadioSelect or isinstance(widget, forms.RadioSelect):
+            if widget is forms.CheckboxSelectMultiple or widget is forms.SelectMultiple or isinstance(widget, forms.SelectMultiple):
+                field = forms.MultipleChoiceField(**setting.field_context)
+            elif widget is forms.RadioSelect or isinstance(widget, forms.RadioSelect):
                 field = forms.ChoiceField(**setting.field_context)
             elif isinstance(setting, (Setting.emulators.get(str, DummySetting), Setting.emulators.get(unicode, DummySetting))):
                 if not setting.field_context.get('widget', None):
@@ -108,6 +110,10 @@ class StringListWidget(forms.Widget):
             return data[name]
 
 class CommaStringListWidget(forms.Textarea):
+    def render(self, name, value, attrs=None):
+        return super(CommaStringListWidget, self).render(name, ', '.join(value), attrs)
+
+
     def value_from_datadict(self, data, files, name):
         if 'submit' in data:
             return map(strip, data[name].split(','))
@@ -117,3 +123,4 @@ class CommaStringListWidget(forms.Textarea):
 
 
 
+