mirror of
https://github.com/django/django.git
synced 2025-08-15 00:00:47 +00:00
Noted that .clear() will delete intermediary models
This commit is contained in:
parent
cab72a439b
commit
a8e84521c4
1 changed files with 6 additions and 3 deletions
|
@ -505,8 +505,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue