diff options
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() | 
