2024-01-06 14:14:15 +01:00
|
|
|
from django import forms
|
|
|
|
from .models import Post, Comment
|
|
|
|
|
|
|
|
|
|
|
|
class PostForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Post
|
|
|
|
fields = ["title", "content"]
|
2024-01-07 00:24:35 +01:00
|
|
|
labels = {"content": "Body"}
|
2024-01-06 14:14:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class CommentForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Comment
|
|
|
|
fields = ["content"]
|
|
|
|
labels = {
|
|
|
|
"content": "Comment",
|
|
|
|
}
|
|
|
|
widgets = {"content": forms.Textarea(attrs={"rows": 3})}
|