diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-23 14:43:48 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-23 14:43:48 +0200 | 
| commit | f5fc6f23f5369df98fb0fdb061bfbac3c9662677 (patch) | |
| tree | 2abd184b08e73352ccb9ddb078b1d48122b5e472 /archaeological_operations/forms.py | |
| parent | d267f410a54aa76b7f9fe02cd754a270f56b3a04 (diff) | |
| download | Ishtar-f5fc6f23f5369df98fb0fdb061bfbac3c9662677.tar.bz2 Ishtar-f5fc6f23f5369df98fb0fdb061bfbac3c9662677.zip  | |
Hide parcel field for UE QA - Add cultural atribution for sites
Diffstat (limited to 'archaeological_operations/forms.py')
| -rw-r--r-- | archaeological_operations/forms.py | 22 | 
1 files changed, 21 insertions, 1 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index a03513861..4ea0847bf 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1216,6 +1216,7 @@ class PeriodForm(CustomForm, ManageOldType, forms.Form):  class ArchaeologicalSiteForm(ManageOldType):      associated_models = {'period': models.Period, 'remain': models.RemainType, +                         'cultural_attribution': models.CulturalAttributionType,                           'spatial_reference_system': SpatialReferenceSystem}      HEADERS = {}      reference = forms.CharField(label=_(u"Reference"), max_length=200) @@ -1226,6 +1227,10 @@ class ArchaeologicalSiteForm(ManageOldType):      remains = forms.MultipleChoiceField(          label=_("Remains"), choices=[], widget=widgets.Select2Multiple,          required=False) +    cultural_attributions = forms.MultipleChoiceField( +        label=_("Cultural attributions"), choices=[], +        widget=widgets.Select2Multiple, +        required=False)      HEADERS['x'] = FormHeader(_(u"Coordinates"))      x = forms.FloatField(label=_(u"X"), required=False)      estimated_error_x = forms.FloatField(label=_(u"Estimated error for X"), @@ -1253,6 +1258,8 @@ class ArchaeologicalSiteForm(ManageOldType):      TYPES = [          FieldType('periods', models.Period, True),          FieldType('remains', models.RemainType, True), +        FieldType('cultural_attributions', models.CulturalAttributionType, +                  True),          FieldType('spatial_reference_system', SpatialReferenceSystem),      ] @@ -1296,11 +1303,14 @@ class ArchaeologicalSiteForm(ManageOldType):          periods = dct.pop('periods')          remains = dct.pop('remains') +        cultural_attributions = dct.pop('cultural_attributions')          item = models.ArchaeologicalSite.objects.create(**dct)          for period in periods:              item.periods.add(period)          for remain in remains:              item.remains.add(remain) +        for cultural_attribution in cultural_attributions: +            item.cultural_attributions.add(cultural_attribution)          return item @@ -1366,6 +1376,8 @@ class SiteSelect(HistorySelect):      name = forms.CharField(label=_(u"Name"), max_length=200, required=False)      periods = forms.ChoiceField(label=_(u"Periods"), choices=[], required=False)      remains = forms.ChoiceField(label=_(u"Remains"), choices=[], required=False) +    cultural_attributions = forms.ChoiceField( +        label=_("Cultural attribution"), choices=[], required=False)      towns = get_town_field()      towns__areas = forms.ChoiceField(label=_("Areas"), choices=[])      comment = forms.CharField(label=_(u"Comment"), max_length=200, @@ -1409,6 +1421,7 @@ class SiteSelect(HistorySelect):      TYPES = [          FieldType('periods', models.Period),          FieldType('remains', models.RemainType), +        FieldType('cultural_attributions', models.CulturalAttributionType),          FieldType('towns__areas', Area),      ] @@ -1467,8 +1480,9 @@ class SiteForm(CustomForm, ManageOldType):      form_slug = u"archaeological_site-010-general"      associated_models = {'period': models.Period, 'remain': models.RemainType,                           'spatial_reference_system': SpatialReferenceSystem, +                         'cultural_attribution': models.CulturalAttributionType,                           'collaborator': Person} -    base_models = ["period", "remain", "collaborator"] +    base_models = ["period", "remain", "collaborator", "cultural_attribution"]      pk = forms.IntegerField(required=False, widget=forms.HiddenInput)      reference = forms.CharField(label=_(u"Reference"), max_length=200) @@ -1479,6 +1493,10 @@ class SiteForm(CustomForm, ManageOldType):      remain = forms.MultipleChoiceField(          label=_("Remains"), choices=[], widget=widgets.Select2Multiple,          required=False) +    cultural_attribution = forms.MultipleChoiceField( +        label=_("Cultural attributions"), choices=[], +        widget=widgets.Select2Multiple, +        required=False)      collaborator = widgets.Select2MultipleField(          model=Person, label=_("Collaborators"), required=False, remote=True)      comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, @@ -1519,6 +1537,8 @@ class SiteForm(CustomForm, ManageOldType):      TYPES = [          FieldType('period', models.Period, True),          FieldType('remain', models.RemainType, True), +        FieldType('cultural_attribution', +                  models.CulturalAttributionType, True),          FieldType('spatial_reference_system', SpatialReferenceSystem),      ]  | 
