33 lines
699 B
Python
33 lines
699 B
Python
from django.forms import (
|
|
ChoiceField,
|
|
Form,
|
|
ModelForm,
|
|
TextInput,
|
|
FileField,
|
|
)
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from ..models import (
|
|
SpecialPeriod,
|
|
)
|
|
|
|
|
|
class SpecialPeriodForm(ModelForm):
|
|
|
|
class Meta:
|
|
model = SpecialPeriod
|
|
fields = "__all__"
|
|
widgets = {
|
|
"start_date": TextInput(attrs={"type": "date"}),
|
|
"end_date": TextInput(attrs={"type": "date"}),
|
|
}
|
|
|
|
|
|
class SpecialPeriodFileForm(Form):
|
|
periodtype = ChoiceField(
|
|
label=_("Period type"),
|
|
required=True,
|
|
choices=SpecialPeriod.PERIODTYPE.choices,
|
|
)
|
|
file = FileField(label=_("ICAL file"), required=True)
|