summaryrefslogtreecommitdiff
path: root/blog/forms.py
diff options
context:
space:
mode:
authorMark Weiman <mark.weiman@markzz.com>2015-10-11 01:00:38 -0400
committerMark Weiman <mark.weiman@markzz.com>2015-10-11 01:00:38 -0400
commit57aa89824a8dabb631c15af986a39e779d0fe3cb (patch)
tree2df3bf79026e1c544e57375566297bcc7634afa5 /blog/forms.py
downloadwebsite-57aa89824a8dabb631c15af986a39e779d0fe3cb.tar.gz
website-57aa89824a8dabb631c15af986a39e779d0fe3cb.zip
inital
Diffstat (limited to 'blog/forms.py')
-rw-r--r--blog/forms.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/blog/forms.py b/blog/forms.py
new file mode 100644
index 0000000..e315ded
--- /dev/null
+++ b/blog/forms.py
@@ -0,0 +1,20 @@
+from django.forms import ModelForm
+
+from .models import Post, Comment
+
+from captcha.fields import ReCaptchaField
+
+
+class PostForm(ModelForm):
+ class Meta:
+ model = Post
+ fields = ['title', 'body', 'header_image', 'comments_enabled']
+ exclude = ['user', 'created', 'edited']
+
+
+class CommentForm(ModelForm):
+ captcha = ReCaptchaField(attrs={'theme' : 'clean'})
+ class Meta:
+ model = Comment
+ fields = ['name', 'email', 'comment', 'captcha']
+ exclude = ['timestamp', 'post']