summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-09-23 12:53:37 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-09-23 12:53:37 +0200
commit807258a84cbfc4e3545b17165339cd17be495112 (patch)
tree06a156a0d2ffe45c4144997931e90752461510b3
parent24e10e637c059fb7b882753248a82f736e04a861 (diff)
downloadIshtar-807258a84cbfc4e3545b17165339cd17be495112.tar.bz2
Ishtar-807258a84cbfc4e3545b17165339cd17be495112.zip
Fix many to many initialisation in wizards
-rw-r--r--archaeological_finds/forms.py6
-rw-r--r--ishtar_common/wizards.py8
2 files changed, 10 insertions, 4 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index c50982dd7..764ef72a2 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -125,7 +125,7 @@ class FindSelect(TableSelect):
forms.IntegerField(label=_(u"Code PATRIARCHE"))
dating__period = forms.ChoiceField(label=_(u"Period"), choices=[])
# TODO search by warehouse
- material_type = forms.ChoiceField(label=_(u"Material type"), choices=[])
+ material_types = forms.ChoiceField(label=_(u"Material type"), choices=[])
object_types = forms.ChoiceField(label=_(u"Object type"), choices=[])
conservatory_state = forms.ChoiceField(label=_(u"Conservatory state"),
choices=[])
@@ -137,9 +137,9 @@ class FindSelect(TableSelect):
super(FindSelect, self).__init__(*args, **kwargs)
self.fields['dating__period'].choices = Period.get_types()
self.fields['dating__period'].help_text = Period.get_help()
- self.fields['material_type'].choices = \
+ self.fields['material_types'].choices = \
models.MaterialType.get_types()
- self.fields['material_type'].help_text = \
+ self.fields['material_types'].help_text = \
models.MaterialType.get_help()
self.fields['conservatory_state'].choices = \
models.ConservatoryState.get_types()
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index cc371b5e2..abbdda711 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -749,9 +749,15 @@ class Wizard(NamedUrlWizardView):
if hasattr(c_form, 'base_fields'):
for base_field in c_form.base_fields.keys():
value = obj
+ base_model = None
if hasattr(c_form, 'base_model') and \
base_field == c_form.base_model:
- key = c_form.base_model + 's'
+ base_model = base_field
+ if hasattr(c_form, 'base_models') and \
+ base_field in c_form.base_models:
+ base_model = base_field
+ if base_model:
+ key = base_model + 's'
initial.setlist(base_field, [
unicode(val.pk) for val in getattr(obj, key).all()])
else: