forum/src/core/forms.py
2022-07-20 11:07:06 -06:00

37 lines
805 B
Python

from django import forms
from .models import Post, Comment
class CommentCreateForm(forms.ModelForm):
class Meta:
model = Comment
fields = (
'content_type',
'object_id',
'content',
)
labels = {
'content': ''
}
widgets = {
'content_type': forms.HiddenInput(),
'object_id': forms.HiddenInput(),
'content': forms.Textarea(attrs={
'placeholder': "Add your comment here, supports markdown"
})
}
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = [
'author',
'title',
'content',
'topic'
]
labels = {
'content': ''
}