butler_ddochi/blog/forms.py
2025-01-17 15:41:11 +09:00

15 lines
577 B
Python

from django import forms
from taggit.forms import TagWidget
from .models import Post
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ['title', 'contents', 'summary', 'tags']
widgets = {
'title': forms.TextInput(attrs={'class': 'form-control'}),
'contents': forms.Textarea(attrs={'class': 'form-control', 'id': 'markdown-editor'}),
'summary': forms.TextInput(attrs={'class': 'form-control'}),
'tags': TagWidget(attrs={'class': 'form-control', 'placeholder': 'Add tags'}),
}