diff options
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 18336cff5..735ad62fd 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -31,6 +31,7 @@ from django.core.files.storage import default_storage from django.core.mail import send_mail from django.db.models.fields.files import FileField from django.db.models.fields.related import ManyToManyField + from django.http import HttpResponseRedirect from django.forms import ValidationError from django.shortcuts import render_to_response, redirect @@ -679,6 +680,18 @@ class Wizard(NamedUrlWizardView): # material_index management for baseitems obj._cached_label_checked = False obj.save() + + # force post_save for old related m2ms (which can have been detached + # from the current object) + for model in old_m2ms: + for item in old_m2ms[model]: + # verify it hasn't been deleted + q = item.__class__.objects.filter(pk=item.pk) + if q.count(): + item = q.all()[0] + item.skip_history_when_saving = True + item.save() + # make the new object a default if self.current_obj_slug: self.request.session[self.current_obj_slug] = unicode(obj.pk) |