From d45ef43c4aba32dbb6e27039256f5f30bdcfeb6e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 30 Apr 2017 15:51:01 +0200 Subject: Better management of many to many --- ishtar_common/wizards.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ishtar_common/wizards.py') diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index e8052c768..cb5e5ca10 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -742,7 +742,9 @@ class Wizard(NamedUrlWizardView): value.save() # force post_save # check that an item is not add multiple times (forged forms) if value not in related_model.all() and\ - hasattr(related_model, 'add'): + hasattr(related_model, 'add') and \ + not isinstance(value, related_model.through): + # many to many and the value have been already managed related_model.add(value) # necessary to manage interaction between models like # material_index management for baseitems -- cgit v1.2.3