From 57aa89824a8dabb631c15af986a39e779d0fe3cb Mon Sep 17 00:00:00 2001 From: Mark Weiman Date: Sun, 11 Oct 2015 01:00:38 -0400 Subject: inital --- blog/forms.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 blog/forms.py (limited to 'blog/forms.py') 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'] -- cgit v1.3.1