Ticket #14099: 14099-PEP8.patch

File 14099-PEP8.patch, 1.9 KB (added by Mark Lavin, 14 years ago)

Small PEP8 cleanup of kenth's original patch (vs [13749])

  • django/forms/models.py

    diff --git a/django/forms/models.py b/django/forms/models.py
    a b  
    1717from fields import Field, ChoiceField
    1818from widgets import SelectMultiple, HiddenInput, MultipleHiddenInput
    1919from widgets import media_property
    20 from formsets import BaseFormSet, formset_factory, DELETION_FIELD_NAME
     20from formsets import BaseFormSet, formset_factory
    2121
    2222__all__ = (
    2323    'ModelForm', 'BaseModelForm', 'model_to_dict', 'fields_for_model',
     
    612612            pk_value = getattr(pk_value, 'pk', pk_value)
    613613
    614614            obj = self._existing_object(pk_value)
    615             if self.can_delete:
    616                 raw_delete_value = form._raw_value(DELETION_FIELD_NAME)
    617                 should_delete = form.fields[DELETION_FIELD_NAME].clean(raw_delete_value)
    618                 if should_delete:
    619                     self.deleted_objects.append(obj)
    620                     obj.delete()
    621                     continue
     615            if self.can_delete and self._should_delete_form(form):
     616                self.deleted_objects.append(obj)
     617                obj.delete()
     618                continue
    622619            if form.has_changed():
    623620                self.changed_objects.append((obj, form.changed_data))
    624621                saved_instances.append(self.save_existing(form, obj, commit=commit))
     
    633630                continue
    634631            # If someone has marked an add form for deletion, don't save the
    635632            # object.
    636             if self.can_delete:
    637                 raw_delete_value = form._raw_value(DELETION_FIELD_NAME)
    638                 should_delete = form.fields[DELETION_FIELD_NAME].clean(raw_delete_value)
    639                 if should_delete:
    640                     continue
     633            if self.can_delete and self._should_delete_form(form):
     634                continue
    641635            self.new_objects.append(self.save_new(form, commit=commit))
    642636            if not commit:
    643637                self.saved_forms.append(form)
Back to Top