Ticket #10284: modelformset_doc.diff

File modelformset_doc.diff, 763 bytes (added by Wedg, 5 years ago)

Doc patch describing new/fixed behavior so people don't forget to delete.

  • docs/topics/forms/modelforms.txt

     
    654654need to call ``formset.save_m2m()`` to ensure the many-to-many relationships
    655655are saved properly.
    656656
     657If you pass ``can_delete=True`` to the ``modelformset_factory``, and you save
     658with ``commit=False``, you need to call delete on each of the
     659``formset.deleted_objects`` to actually delete them::
     660
     661    # really delete instances
     662    >>> instances = formset.save(commit=False)
     663    >>> for obj in formset.deleted_objects:
     664    ...     obj.delete()
     665
    657666.. _model-formsets-max-num:
    658667
    659668Limiting the number of editable objects
Back to Top