summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-20 20:09:06 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-20 20:09:06 +0100
commitd26217d09080ef93fe0b36c3543a266d7a04c688 (patch)
tree99faaf3ec3a2d6da7d265995419dc6af45a69fbe /ishtar_common/wizards.py
parent4abb5ff78620c096ab4238535c8e4b22291a2cb1 (diff)
parentac595e9aa13d27fb15e70eb1f6e2d11f928a4c4a (diff)
downloadIshtar-d26217d09080ef93fe0b36c3543a266d7a04c688.tar.bz2
Ishtar-d26217d09080ef93fe0b36c3543a266d7a04c688.zip
Merge branch 'v0.9' into wheezy
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 4f0295421..18336cff5 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -570,8 +570,11 @@ class Wizard(NamedUrlWizardView):
# remove non relevant fields
all_field_names = self.get_saved_model()._meta.get_all_field_names()
for k in dct.copy():
- if (k.endswith('_id') and k[:-3] not in all_field_names) and \
- k not in all_field_names:
+ if not (k.endswith('_id') and k[:-3] in all_field_names) \
+ and k not in all_field_names and \
+ (not hasattr(self.get_saved_model(),
+ 'EXTRA_SAVED_KEYS') or
+ k not in self.get_saved_model().EXTRA_SAVED_KEYS):
dct.pop(k)
saved_args = self.saved_args.copy()
for k in saved_args:
@@ -631,7 +634,11 @@ class Wizard(NamedUrlWizardView):
if type(value) == dict:
model = related_model.model
if hasattr(related_model, 'through') and \
- related_model.through:
+ related_model.through and \
+ hasattr(related_model.through, 'RELATIVE_MODELS') \
+ and self.get_saved_model() in \
+ related_model.through.RELATIVE_MODELS:
+ # the form is dealing with the through parameter
model = related_model.through
# not m2m -> foreign key
if not hasattr(related_model, 'clear'):
@@ -687,7 +694,9 @@ class Wizard(NamedUrlWizardView):
return return_object and (obj, res) or res
def get_deleted(self, keys):
- """Get the deleted and non-deleted items in formsets"""
+ """
+ Get the deleted and non-deleted items in formsets
+ """
not_to_delete, to_delete = set(), set()
for key in keys:
items = key.split('-')