diff options
| -rw-r--r-- | ishtar_common/wizards.py | 20 | 
1 files changed, 12 insertions, 8 deletions
| diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index b04ef48ee..e1f031818 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -456,7 +456,8 @@ class Wizard(NamedUrlWizardView):                      data.pop(key)                  if to_delete:                      # reorganize -                    for idx, number in enumerate(sorted(not_to_delete)): +                    for idx, number in enumerate(sorted(not_to_delete, +                                                        key=lambda x:int(x))):                          idx = unicode(idx)                          if idx == number:                              continue @@ -481,12 +482,13 @@ class Wizard(NamedUrlWizardView):                      total_field = max((total_field, len(init)))                  data[step + u'-INITIAL_FORMS'] = unicode(total_field)                  data[step + u'-TOTAL_FORMS'] = unicode(total_field + 1) +                # TODO:remove form_initialized?                  # update initialization -                if request.POST and init and hasattr(self, 'form_initialized') \ -                   and self.form_initialized: -                    for k in init[0]: -                        data[step + '-' + unicode(total_field) + '-' + k] = \ -                                                                      init[0][k] +                #if request.POST and init and hasattr(self, 'form_initialized') \ +                #   and self.form_initialized: +                #    for k in init[0]: +                #        data[step + '-' + unicode(total_field) + '-' + k] = \ +                #                                                      init[0][k]          data = data or None          form = super(Wizard, self).get_form(step, data, files)          return form @@ -498,8 +500,10 @@ class Wizard(NamedUrlWizardView):           - validate and end: nextstep = last step          """          request = self.request -        if request.POST.has_key('formset_modify') \ -           and request.POST['formset_modify'] \ +        if (request.POST.has_key('formset_modify') \ +            and request.POST['formset_modify']) \ +           or (request.POST.has_key('formset_add') \ +            and request.POST['formset_add']) \             or [key for key in request.POST.keys()                 if key.endswith('DELETE') and request.POST[key]]:              return self.render(form) | 
