summaryrefslogtreecommitdiff
path: root/ishtar/furnitures/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r--ishtar/furnitures/forms.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py
index bf01fb501..0f93a94bc 100644
--- a/ishtar/furnitures/forms.py
+++ b/ishtar/furnitures/forms.py
@@ -381,9 +381,10 @@ class Wizard(NamedUrlSessionFormWizard):
m2m_items[key] = getattr(obj, key+'s').all()
if value not in m2m_items[key]:
if type(value) == dict:
- if issubclass(obj.__class__, models.BaseHistorizedItem):
+ model = getattr(obj, key+'s').model
+ if issubclass(model, models.BaseHistorizedItem):
value['history_modifier'] = request.user
- value = getattr(obj, key+'s').model.objects.create(**value)
+ value = model.objects.create(**value)
value.save()
getattr(obj, key+'s').add(value)
obj.save()
@@ -1921,12 +1922,18 @@ DatingFormSet.form_label = _("Dating")
class RecordFormInterpretation(forms.Form):
form_label = _("Interpretation")
+ associated_models = {'activity':models.ActivityType,
+ 'identification':models.IdentificationType,}
has_furniture = forms.NullBooleanField(label=_(u"Has furniture?"),
required=False)
filling = forms.CharField(label=_(u"Filling"),
widget=forms.Textarea, required=False)
interpretation = forms.CharField(label=_(u"Interpretation"),
widget=forms.Textarea, required=False)
+ activity = forms.ChoiceField(label=_("Activity"), required=False,
+ choices=[])
+ identification = forms.ChoiceField(label=_("Identification"),
+ required=False, choices=[])
taq = forms.IntegerField(label=_(u"TAQ"), required=False)
taq_estimated = forms.IntegerField(label=_(u"Estimated TAQ"),
required=False)
@@ -1934,6 +1941,12 @@ class RecordFormInterpretation(forms.Form):
tpq_estimated = forms.IntegerField(label=_(u"Estimated TPQ"),
required=False)
+ def __init__(self, *args, **kwargs):
+ super(RecordFormInterpretation, self).__init__(*args, **kwargs)
+ self.fields['activity'].choices = models.ActivityType.get_types()
+ self.fields['identification'].choices = \
+ models.IdentificationType.get_types()
+
record_search_wizard = SearchWizard([
('general-record_search', RecordFormSelection)],
url_name='record_search',)