summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
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('-')