Django Model() 與 Model.objects.create() - Django Model() vs Model.objects.create()

問題:

What it the difference between running two commands:運行兩個命令有什麼區別:

foo = FooModel()

and

bar = BarModel.objects.create()

Does the second one immediately create a BarModel in the database, while for FooModel , the save() method has to be called explicitly to add it to the database?第二個是否立即在數據庫中創建一個BarModel ,而對於FooModel ,必須顯式調用save()方法才能將其添加到數據庫中?


解決方案:

參考一: https://stackoom.com/question/1nucn
參考二: Django Model() vs Model.objects.create()
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章