書名: Django 2 by Example作者名: Antonio Melé本章字數: 47字更新時間: 2021-06-25 21:19:01
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.
推薦閱讀
- 面向物聯網的CC2530與傳感器應用開發
- Spring Boot 2.0 Projects
- Hands-On Industrial Internet of Things
- 計算機網絡安全實訓教程(第二版)
- HTML5 Game development with ImpactJS
- Getting Started with WebRTC
- Mastering TypeScript 3
- 物聯網之霧:基于霧計算的智能硬件快速反應與安全控制
- Dart Cookbook
- 云工廠:開啟中國制造云時代
- Web用戶查詢日志挖掘與應用
- 信息技術安全評估準則:源流、方法與實踐
- 物聯網,So Easy!
- 中國信息化年鑒2017
- 現場總線與工業以太網及其應用技術(第2版)