diff options
| author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-09-08 12:42:19 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-09-08 12:42:19 +0200 | 
| commit | 3674db3c0db88d5d4d60a6f8ff9a06d7f5523bd0 (patch) | |
| tree | d73ef264ef8a973ddfb5a170f7624bbf6db49241 /ishtar_common/wizards.py | |
| parent | a9423fb3feaf48baee1766823dfdb80f5b629c52 (diff) | |
| download | Ishtar-3674db3c0db88d5d4d60a6f8ff9a06d7f5523bd0.tar.bz2 Ishtar-3674db3c0db88d5d4d60a6f8ff9a06d7f5523bd0.zip | |
Manage wizard formset when no required field is available (refs #1386, refs #1387)
Diffstat (limited to 'ishtar_common/wizards.py')
| -rw-r--r-- | ishtar_common/wizards.py | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index c394fee09..d006db9ad 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -480,9 +480,15 @@ class Wizard(NamedUrlWizardView):                      frm = frm()                  required_fields = [k for k in frm.fields                                     if frm.fields[k].required] -                base_key = required_fields[-1] +                base_key = None +                if required_fields: +                    base_key = required_fields[-1] +                elif frm.fields.keys(): +                    base_key = frm.fields.keys()[-1]                  init = self.get_form_initial(step, data=data) -                total_field = len([key for key in data.keys() +                total_field = 0 +                if base_key: +                    total_field = len([key for key in data.keys()                                          if base_key in key.split('-')                                             and data[key]])                  if init and not to_delete and ( | 
