summaryrefslogtreecommitdiff
path: root/archaeological_operations/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r--archaeological_operations/forms.py38
1 files changed, 10 insertions, 28 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 5aaee4112..3d679d555 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -805,50 +805,32 @@ class RemainForm(forms.Form):
form_label = _("Remain types")
base_model = 'remain'
associated_models = {'remain': models.RemainType}
- remain = forms.ChoiceField(label=_("Remain type"), required=False,
- choices=[])
+ remain = forms.MultipleChoiceField(
+ label=_("Remain type"), required=False, choices=[],
+ widget=forms.CheckboxSelectMultiple)
def __init__(self, *args, **kwargs):
super(RemainForm, self).__init__(*args, **kwargs)
- self.fields['remain'].choices = models.RemainType.get_types()
+ self.fields['remain'].choices = models.RemainType.get_types(
+ empty_first=False)
self.fields['remain'].help_text = models.RemainType.get_help()
-class RemainFormSet(FormSet):
- def clean(self):
- """Checks that no remain types are duplicated."""
- return self.check_duplicate(['remain_type'],
- _(u"There are identical remain types"))
-
-RemainFormset = formset_factory(RemainForm, can_delete=True,
- formset=RemainFormSet)
-RemainFormset.form_label = _("Remain types")
-
-
class PeriodForm(forms.Form):
form_label = _("Periods")
base_model = 'period'
associated_models = {'period': models.Period}
- period = forms.ChoiceField(label=_("Period"), required=False,
- choices=[])
+ period = forms.MultipleChoiceField(
+ label=_("Period"), required=False, choices=[],
+ widget=forms.CheckboxSelectMultiple)
def __init__(self, *args, **kwargs):
super(PeriodForm, self).__init__(*args, **kwargs)
- self.fields['period'].choices = models.Period.get_types()
+ self.fields['period'].choices = models.Period.get_types(
+ empty_first=False)
self.fields['period'].help_text = models.Period.get_help()
-class PeriodFormSet(FormSet):
- def clean(self):
- """Checks that no period are duplicated."""
- return self.check_duplicate(['period'],
- _(u"There are identical periods"))
-
-PeriodFormset = formset_factory(PeriodForm, can_delete=True,
- formset=PeriodFormSet)
-PeriodFormset.form_label = _("Periods")
-
-
class ArchaeologicalSiteForm(forms.Form):
reference = forms.CharField(label=_(u"Reference"), max_length=20)
name = forms.CharField(label=_(u"Name"), max_length=200, required=False)