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'}), }