diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-17 19:31:14 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-17 19:31:14 +0200 |
commit | 585c1206ce9d32ed70a74c0c4d25b510164389f2 (patch) | |
tree | 5a05340c85d5a3d0d6bae556f8020d9ef914fede /ishtar_common/wizards.py | |
parent | 8c077c5d9c392e5eb7358610f4a843d4f74f3e72 (diff) | |
download | Ishtar-585c1206ce9d32ed70a74c0c4d25b510164389f2.tar.bz2 Ishtar-585c1206ce9d32ed70a74c0c4d25b510164389f2.zip |
Warehouse: fix division form int and save
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 6209a16c3..9a068063b 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -705,8 +705,11 @@ class Wizard(IshtarWizard): related_model = getattr(obj, model + 's') # manage through if hasattr(related_model, 'through') and related_model.through: - related_set_name = str( - related_model.through.__name__ + '_set').lower() + if hasattr(related_model.through, "RELATED_SET_NAME"): + related_set_name = related_model.through.RELATED_SET_NAME + else: + related_set_name = str( + related_model.through.__name__ + '_set').lower() if hasattr(obj, related_set_name): related_model = getattr(obj, related_set_name) # clear real m2m @@ -732,6 +735,9 @@ class Wizard(IshtarWizard): (field.related_model == related_model.model or isinstance(obj, field.related_model)): continue + if field.name in getattr( + related_model.through, 'RELATED_ATTRS', []): + continue related_data[field.name] = None if key not in m2m_items: @@ -1320,8 +1326,8 @@ class Wizard(IshtarWizard): # manage through through = False if hasattr(related, 'through') and related.through: - if hasattr(c_form, "form_through_name"): - related_set_name = c_form.form_through_name + if hasattr(related.through, "RELATED_SET_NAME"): + related_set_name = related.through.RELATED_SET_NAME else: related_set_name = str( related.through.__name__ + '_set').lower() |