blob: e315dedea50f08554deff91da483de2e960cf757 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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']
|