diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-10-25 12:18:24 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-10-25 12:18:24 +0100 |
commit | b39e8de9c8da4905477d142e7c7dd630864335f8 (patch) | |
tree | 22e09f884928f77709d799cf7bd75a2e687dabc9 /archaeological_finds/forms.py | |
parent | 2018f169a8eccdd4f08bdd9cc27edc2e238d1eb6 (diff) | |
download | Ishtar-b39e8de9c8da4905477d142e7c7dd630864335f8.tar.bz2 Ishtar-b39e8de9c8da4905477d142e7c7dd630864335f8.zip |
Finds: dating -> datings
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r-- | archaeological_finds/forms.py | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index deb9ce4dc..30a5a40fa 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -94,28 +94,33 @@ class FindForm(forms.Form): class DateForm(forms.Form): form_label = _("Dating") base_model = 'dating' - associated_models = {'dating__dating_type': DatingType, - 'dating__quality': DatingQuality, - 'dating__period': Period} - dating__period = forms.ChoiceField(label=_("Period"), choices=[]) - dating__start_date = forms.IntegerField(label=_(u"Start date"), - required=False) - dating__end_date = forms.IntegerField(label=_(u"End date"), required=False) - dating__quality = forms.ChoiceField(label=_("Quality"), required=False, - choices=[]) - dating__dating_type = forms.ChoiceField(label=_("Dating type"), - required=False, choices=[]) - dating__precise_dating = forms.CharField(label=_("Precise dating"), - required=False) + associated_models = {'dating_type': DatingType, + 'quality': DatingQuality, + 'period': Period} + period = forms.ChoiceField(label=_("Period"), choices=[]) + start_date = forms.IntegerField(label=_(u"Start date"), + required=False) + end_date = forms.IntegerField(label=_(u"End date"), required=False) + quality = forms.ChoiceField(label=_("Quality"), required=False, + choices=[]) + dating_type = forms.ChoiceField(label=_("Dating type"), + required=False, choices=[]) + precise_dating = forms.CharField(label=_("Precise dating"), + required=False) def __init__(self, *args, **kwargs): super(DateForm, self).__init__(*args, **kwargs) - self.fields['dating__dating_type'].choices = DatingType.get_types() - self.fields['dating__dating_type'].help_text = DatingType.get_help() - self.fields['dating__period'].choices = Period.get_types() - self.fields['dating__period'].help_text = Period.get_help() - self.fields['dating__quality'].choices = DatingQuality.get_types() - self.fields['dating__quality'].help_text = DatingQuality.get_help() + self.fields['dating_type'].choices = DatingType.get_types() + self.fields['dating_type'].help_text = DatingType.get_help() + self.fields['period'].choices = Period.get_types() + self.fields['period'].help_text = Period.get_help() + self.fields['quality'].choices = DatingQuality.get_types() + self.fields['quality'].help_text = DatingQuality.get_help() + + +DatingFormSet = formset_factory(DateForm, can_delete=True, + formset=FormSet) +DatingFormSet.form_label = _("Dating") class FindSelect(TableSelect): @@ -124,7 +129,7 @@ class FindSelect(TableSelect): label=_(u"Year")) base_finds__context_record__operation__code_patriarche = \ forms.IntegerField(label=_(u"Code PATRIARCHE")) - dating__period = forms.ChoiceField(label=_(u"Period"), choices=[]) + datings__period = forms.ChoiceField(label=_(u"Period"), choices=[]) # TODO search by warehouse material_types = forms.ChoiceField(label=_(u"Material type"), choices=[]) object_types = forms.ChoiceField(label=_(u"Object type"), choices=[]) @@ -136,8 +141,8 @@ class FindSelect(TableSelect): def __init__(self, *args, **kwargs): super(FindSelect, self).__init__(*args, **kwargs) - self.fields['dating__period'].choices = Period.get_types() - self.fields['dating__period'].help_text = Period.get_help() + self.fields['datings__period'].choices = Period.get_types() + self.fields['datings__period'].help_text = Period.get_help() self.fields['material_types'].choices = \ models.MaterialType.get_types() self.fields['material_types'].help_text = \ @@ -276,7 +281,7 @@ SourceFindFormSelection = get_form_selection( class FindSourceSelect(SourceSelect): find__base_finds__context_record__operation__year = forms.IntegerField( label=_(u"Year of the operation")) - find__dating__period = forms.ChoiceField( + find__datings__period = forms.ChoiceField( label=_(u"Period of the archaelogical find"), choices=[]) find__material_type = forms.ChoiceField( label=_("Material type of the archaelogical find"), choices=[]) @@ -285,8 +290,8 @@ class FindSourceSelect(SourceSelect): def __init__(self, *args, **kwargs): super(FindSourceSelect, self).__init__(*args, **kwargs) - self.fields['find__dating__period'].choices = Period.get_types() - self.fields['find__dating__period'].help_text = Period.get_help() + self.fields['find__datings__period'].choices = Period.get_types() + self.fields['find__datings__period'].help_text = Period.get_help() self.fields['find__material_type'].choices = \ models.MaterialType.get_types() self.fields['find__material_type'].help_text = \ |