开发者

Difference in Django object creation call

开发者 https://www.devze.com 2022-12-22 05:18 出处:网络
I\'d like to know if there\'s a difference between the following two calls to create an object in Django

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

精彩评论

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