diff gpp/forums/forms.py @ 111:e5faf9f0c11a

Forums: implemented the bulk moderator functions that operate on a forum: bulk sticky, lock, delete, and move. These haven't been tested that well yet.
author Brian Neal <bgneal@gmail.com>
date Mon, 28 Sep 2009 03:57:09 +0000
parents c329bfaed4a7
children d1b0b86441c0
line wrap: on
line diff
--- a/gpp/forums/forms.py	Sat Sep 26 20:19:45 2009 +0000
+++ b/gpp/forums/forms.py	Mon Sep 28 03:57:09 2009 +0000
@@ -109,14 +109,20 @@
 
 
 class MoveTopicForm(forms.Form):
-   """
-   Form for a moderator to move a topic to a forum.
-   """
-   forums = forms.ModelChoiceField(label='Move to forum', 
-         queryset=Forum.objects.none())
+    """
+    Form for a moderator to move a topic to a forum.
+    """
+    forums = forms.ModelChoiceField(label='Move to forum', 
+          queryset=Forum.objects.none())
 
-   def __init__(self, user, *args, **kwargs):
-      super(MoveTopicForm, self).__init__(*args, **kwargs)
-      self.fields['forums'].queryset = \
-              Forum.objects.forums_for_user(user).order_by('name')
+    def __init__(self, user, *args, **kwargs):
+        hide_label = kwargs.pop('hide_label', False) 
+        required = kwargs.pop('required', True)
+        super(MoveTopicForm, self).__init__(*args, **kwargs)
+        self.fields['forums'].queryset = \
+            Forum.objects.forums_for_user(user).order_by('name')
+        if hide_label:
+            self.fields['forums'].label = ''
+        self.fields['forums'].required = required
+        print '#############', required