2024-03-20 08:19:58 +00:00
|
|
|
from django import forms
|
2024-03-22 11:45:50 +00:00
|
|
|
from .models import AdoptionNotice, Animal, Image, Report, ModerationAction
|
2024-03-20 08:19:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DateInput(forms.DateInput):
|
|
|
|
input_type = 'date'
|
|
|
|
|
|
|
|
|
|
|
|
class AdoptionNoticeForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = AdoptionNotice
|
|
|
|
fields = ['name', "group_only", "further_information", "description", "searching_since"]
|
|
|
|
widgets = {
|
|
|
|
'searching_since': DateInput(),
|
|
|
|
}
|
|
|
|
|
2024-03-20 12:40:00 +00:00
|
|
|
|
2024-03-20 08:19:58 +00:00
|
|
|
class AnimalForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Animal
|
2024-03-20 10:38:30 +00:00
|
|
|
picture = forms.ImageField(label='Image', required=False)
|
|
|
|
fields = ['name', "species", "sex", "date_of_birth", "description"]
|
2024-03-20 08:19:58 +00:00
|
|
|
widgets = {
|
|
|
|
'date_of_birth': DateInput(),
|
2024-03-20 12:40:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class ImageForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Image
|
|
|
|
fields = ('title', 'image', 'alt_text')
|
2024-03-22 11:45:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ReportForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = Report
|
|
|
|
fields = ('reported_broken_rules', 'comment')
|
|
|
|
|
|
|
|
|
|
|
|
class ModerationActionForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = ModerationAction
|
|
|
|
fields = ('action', 'public_comment', 'private_comment')
|