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

前端 未结 4 1218
执笔经年
执笔经年 2020-12-04 06:06

What it the difference between running two commands:

foo = FooModel()

and

bar = BarModel.objects.create()

4条回答
  •  眼角桃花
    2020-12-04 06:36

    https://docs.djangoproject.com/en/stable/topics/db/queries/#creating-objects

    To create and save an object in a single step, use the create() method.

提交回复
热议问题