mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-30 23:33:43 +03:00
17 lines
501 B
Python
17 lines
501 B
Python
from ckeditor.fields import RichTextFormField
|
|
from django import forms
|
|
|
|
from akarpov.blog.models import Post, Tag
|
|
|
|
|
|
class PostForm(forms.ModelForm):
|
|
body = RichTextFormField(label="")
|
|
image = forms.ImageField(help_text="better use horizontal images", required=False)
|
|
tags = forms.ModelMultipleChoiceField(
|
|
queryset=Tag.objects.all(), widget=forms.CheckboxSelectMultiple, required=True
|
|
)
|
|
|
|
class Meta:
|
|
model = Post
|
|
fields = ["title", "body", "image", "tags"]
|