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