Skip to content
Browse files

added missing forms.py

  • Loading branch information...
1 parent 686bd6e commit efd71ba18a340f4f2c89a1756531d5c04bc9f34f @brosner brosner committed Dec 16, 2011
Showing with 32 additions and 0 deletions.
  1. +32 −0 agora/forms.py
View
32 agora/forms.py
@@ -0,0 +1,32 @@
+from django import forms
+
+from agora.models import ForumThread, ForumReply
+
+
+class PostForm(object):
+
+ subscribe = forms.BooleanField(required=False)
+
+ def __init__(self, *args, **kwargs):
+ no_subscribe = kwargs.pop("no_subscribe", False)
+ super(PostForm, self).__init__(*args, **kwargs)
+ if no_subscribe:
+ del self.fields["subscribe"]
+
+
+class ThreadForm(PostForm, forms.ModelForm):
+
+ subscribe = forms.BooleanField(required=False)
+
+ class Meta:
+ model = ForumThread
+ fields = ["title", "content"]
+
+
+class ReplyForm(PostForm, forms.ModelForm):
+
+ subscribe = forms.BooleanField(required=False)
+
+ class Meta:
+ model = ForumReply
+ fields = ["content"]

0 comments on commit efd71ba

Please sign in to comment.
Something went wrong with that request. Please try again.