diff options
Diffstat (limited to 'archaeological_context_records/forms.py')
| -rw-r--r-- | archaeological_context_records/forms.py | 16 | 
1 files changed, 10 insertions, 6 deletions
| diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 48b198fe3..ce9175d10 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -93,8 +93,7 @@ class RecordFormGeneral(forms.Form):      width = forms.IntegerField(label=_(u"Width (cm)"), required=False)      thickness = forms.IntegerField(label=_(u"Thickness (cm)"), required=False)      depth = forms.IntegerField(label=_(u"Depth (cm)"), required=False) -    unit = forms.ChoiceField(label=_("Unit"), required=False, -                             choices=models.Unit.get_types()) +    unit = forms.ChoiceField(label=_("Unit"), required=False, choices=[])      location = forms.CharField(label=_(u"Location"), widget=forms.Textarea,             required=False, validators=[validators.MaxLengthValidator(200)]) @@ -125,6 +124,8 @@ class RecordFormGeneral(forms.Form):                  self.fields['parcel'].choices.append(   (" - ".join(key), [(parcel.pk, parcel.short_label()) for parcel in gparcels])                  ) +        self.fields['unit'].choices = models.Unit.get_types() +        self.fields['unit'].help_text = models.Unit.get_help()      def clean(self):          # manage unique context record ID @@ -146,18 +147,21 @@ class DatingForm(forms.Form):      associated_models = {'dating_type':models.DatingType,                           'quality':models.DatingQuality,                           'period':models.Period} -    period = forms.ChoiceField(label=_("Period"), choices=Period.get_types()) +    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=models.DatingQuality.get_types()) +    quality = forms.ChoiceField(label=_("Quality"), required=False, choices=[])      dating_type = forms.ChoiceField(label=_("Dating type"), required=False, -                               choices=[]) +                                    choices=[])      def __init__(self, *args, **kwargs):          super(DatingForm, self).__init__(*args, **kwargs)          self.fields['dating_type'].choices = models.DatingType.get_types()          self.fields['dating_type'].help_text = models.DatingType.get_help() +        self.fields['quality'].choices = models.DatingQuality.get_types() +        self.fields['quality'].help_text = models.DatingQuality.get_help() +        self.fields['period'].choices = Period.get_types() +        self.fields['period'].help_text = Period.get_help()  DatingFormSet = formset_factory(DatingForm, can_delete=True, | 
