开发者

Difference in Django object creation call

I'd like to know if there's a difference between the following two calls to create an object in Django

Animal.objects.create(name="cat", sound="meow")

and

Animal(name="cat", sound="meow")

I see both in test cases and I want to make sure I am not missing some开发者_StackOverflowthing.

thanks


The former also inserts a row in the database as well as creating the object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜