clear()
Removes all objects from the related object set:
>>> b = Blog.objects.get(id=1) >>> b.entry_set.clear()
Note this doesn’t delete the related objects – it just disassociates them.
Just like remove()
, clear()
is only available on ForeignKey
s where null=True
and it also accepts the bulk
keyword argument.
Please login to continue.