2010-10-18 21:34:47 +08:00
|
|
|
from django import forms
|
|
|
|
|
2011-10-14 05:34:56 +08:00
|
|
|
from .models import Author
|
2010-10-18 21:34:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
class AuthorForm(forms.ModelForm):
|
|
|
|
name = forms.CharField()
|
|
|
|
slug = forms.SlugField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Author
|
2013-02-22 05:56:55 +08:00
|
|
|
fields = ['name', 'slug']
|
2012-12-04 20:18:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ContactForm(forms.Form):
|
|
|
|
name = forms.CharField()
|
|
|
|
message = forms.CharField(widget=forms.Textarea)
|
2021-07-13 22:06:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ConfirmDeleteForm(forms.Form):
|
|
|
|
confirm = forms.BooleanField()
|
|
|
|
|
|
|
|
def clean(self):
|
|
|
|
cleaned_data = super().clean()
|
|
|
|
if 'confirm' not in cleaned_data:
|
|
|
|
raise forms.ValidationError('You must confirm the delete.')
|