diff gpp/forums/forms.py @ 110:c329bfaed4a7

Forums: implemented the move topic feature.
author Brian Neal <bgneal@gmail.com>
date Sat, 26 Sep 2009 20:19:45 +0000
parents 80ab249d1adc
children e5faf9f0c11a
line wrap: on
line diff
--- a/gpp/forums/forms.py	Sat Sep 26 18:03:57 2009 +0000
+++ b/gpp/forums/forms.py	Sat Sep 26 20:19:45 2009 +0000
@@ -4,6 +4,7 @@
 from django import forms
 from django.conf import settings
 
+from forums.models import Forum
 from forums.models import Topic
 from forums.models import Post
 
@@ -105,3 +106,17 @@
         }
         js = settings.GPP_THIRD_PARTY_JS['markitup'] + \
             ('js/forums.js', )
+
+
+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())
+
+   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')
+