comparison 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
comparison
equal deleted inserted replaced
109:07be3e39e639 110:c329bfaed4a7
2 Forms for the forums application. 2 Forms for the forums application.
3 """ 3 """
4 from django import forms 4 from django import forms
5 from django.conf import settings 5 from django.conf import settings
6 6
7 from forums.models import Forum
7 from forums.models import Topic 8 from forums.models import Topic
8 from forums.models import Post 9 from forums.models import Post
9 10
10 11
11 class NewPostForm(forms.Form): 12 class NewPostForm(forms.Form):
103 css = { 104 css = {
104 'all': settings.GPP_THIRD_PARTY_CSS['markitup'], 105 'all': settings.GPP_THIRD_PARTY_CSS['markitup'],
105 } 106 }
106 js = settings.GPP_THIRD_PARTY_JS['markitup'] + \ 107 js = settings.GPP_THIRD_PARTY_JS['markitup'] + \
107 ('js/forums.js', ) 108 ('js/forums.js', )
109
110
111 class MoveTopicForm(forms.Form):
112 """
113 Form for a moderator to move a topic to a forum.
114 """
115 forums = forms.ModelChoiceField(label='Move to forum',
116 queryset=Forum.objects.none())
117
118 def __init__(self, user, *args, **kwargs):
119 super(MoveTopicForm, self).__init__(*args, **kwargs)
120 self.fields['forums'].queryset = \
121 Forum.objects.forums_for_user(user).order_by('name')
122