Commit 82e756da authored by Cody Scott's avatar Cody Scott Committed by Tim Graham
Browse files

[1.6.x] Noted that .clear() will delete intermediary models

Backport of a8e84521 from master
parent c9917f4c
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -504,8 +504,11 @@ disabled for similar reasons. However, the
:meth:`~django.db.models.fields.related.RelatedManager.clear` method can be
used to remove all many-to-many relationships for an instance::

    # Beatles have broken up
    >>> # Beatles have broken up
    >>> beatles.members.clear()
    >>> # Note that this deletes the intermediate model instances
    >>> Membership.objects.all()
    []

Once you have established the many-to-many relationships by creating instances
of your intermediate model, you can issue queries. Just as with normal