diff options
| -rw-r--r-- | archaeological_context_records/forms.py | 6 | ||||
| -rw-r--r-- | archaeological_operations/forms.py | 3 | 
2 files changed, 5 insertions, 4 deletions
| diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 0504577c5..a4577df40 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -244,11 +244,11 @@ class RecordFormGeneral(CustomForm, ManageOldType):                      (" - ".join([k for k in key if k]),                       [(parcel.pk, parcel.short_label) for parcel in gparcels])                  ) -            if len(self.fields['parcel'].choices) == 1: +            if len(self.fields['parcel'].choices) == 1 and \ +                    'town' in self.fields:                  # only the empty choice is available                  self.fields.pop('parcel') -                if 'town' in self.fields: -                    self.fields['town'].required = True +                self.fields['town'].required = True              if 'town' in self.fields:                  if self.fields['town'].required:                      self.fields['town'].choices = []  # remove the empty choice diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index c3507c3fd..69edc4e1f 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1306,6 +1306,8 @@ class SiteForm(CustomForm, ManageOldType):      form_admin_name = _(u"Archaeological site - 010 - General")      form_slug = u"archaeological_site-010-general"      associated_models = {'period': models.Period, 'remain': models.RemainType} +    base_models = ["period", "remain"] +      pk = forms.IntegerField(required=False, widget=forms.HiddenInput)      reference = forms.CharField(label=_(u"Reference"), max_length=20)      name = forms.CharField(label=_(u"Name"), max_length=200, required=False) @@ -1325,7 +1327,6 @@ class SiteForm(CustomForm, ManageOldType):      )      comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea,                                required=False) -      TYPES = [          FieldType('period', models.Period, True),          FieldType('remain', models.RemainType, True), | 
