summaryrefslogtreecommitdiff
path: root/archaeological_context_records/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-07-17 15:45:57 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-07-17 15:45:57 +0200
commit8bb0a8a8bf383e752486a6b08f43edd421750278 (patch)
treee7c6641975b890f2f2f1d44a96d13a9ce02fb4cc /archaeological_context_records/forms.py
parent2fa1a102e1fa674618b98abdad715dab4b5db779 (diff)
downloadIshtar-8bb0a8a8bf383e752486a6b08f43edd421750278.tar.bz2
Ishtar-8bb0a8a8bf383e752486a6b08f43edd421750278.zip
Fix cache issues
Diffstat (limited to 'archaeological_context_records/forms.py')
-rw-r--r--archaeological_context_records/forms.py16
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,