Ticket #9061: t9061-a.diff

File t9061-a.diff, 1.3 KB (added by Gabriel Farrell, 16 years ago)

newer diff with edit to forms.models to avoid error on save

  • django/forms/formsets.py

     
    242242                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_(u'Order'), initial=index+1, required=False)
    243243            else:
    244244                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_(u'Order'), required=False)
    245         if self.can_delete:
     245        if self.can_delete and index < self._initial_form_count:
    246246            form.fields[DELETION_FIELD_NAME] = BooleanField(label=_(u'Delete'), required=False)
    247247
    248248    def add_prefix(self, index):
  • django/forms/models.py

     
    400400        for form in self.extra_forms:
    401401            if not form.has_changed():
    402402                continue
    403             # If someone has marked an add form for deletion, don't save the
    404             # object.
    405             if self.can_delete and form.cleaned_data[DELETION_FIELD_NAME]:
    406                 continue
    407403            self.new_objects.append(self.save_new(form, commit=commit))
    408404            if not commit:
    409405                self.saved_forms.append(form)
Back to Top