summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-04-30 15:51:01 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-04-30 15:51:01 +0200
commitd45ef43c4aba32dbb6e27039256f5f30bdcfeb6e (patch)
treef61334286014a52808389c83f6e65b6cbaea16ca /ishtar_common/wizards.py
parentc0dc48961e9c162256e2cdd53355ba696c44c127 (diff)
downloadIshtar-d45ef43c4aba32dbb6e27039256f5f30bdcfeb6e.tar.bz2
Ishtar-d45ef43c4aba32dbb6e27039256f5f30bdcfeb6e.zip
Better management of many to many
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py4
1 files changed, 3 insertions, 1 deletions
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