Django 2 by Example
上QQ阅读APP看书,第一时间看更新

Deleting objects

If you want to delete an object, you can do it from the object instance using the delete() method:

post = Post.objects.get(id=1)
post.delete()

Note that deleting objects will also delete any dependent relationships for ForeignKey objects defined with on_delete set to CASCADE.