Ticket #10180: django-inlineformset-save-new.diff

File django-inlineformset-save-new.diff, 688 bytes (added by Simon Litchfield, 16 years ago)
  • django/forms/models.py

     
    493493        fk_attname = self.fk.get_attname()
    494494        kwargs = {fk_attname: self.instance.pk}
    495495        new_obj = self.model(**kwargs)
     496        exclude = [self.fk.name, fk_attname]
    496497        if fk_attname == self._pk_field.attname:
    497             exclude =  [self._pk_field.name]
    498         else:
    499             exclude = []
     498            exclude.append(self._pk_field.name)
    500499        return save_instance(form, new_obj, exclude=exclude, commit=commit)
    501500
    502501    def add_fields(self, form, index):
Back to Top