views:

24

answers:

1

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 something.

thanks

+2  A: 

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

Ignacio Vazquez-Abrams
you mean it saves it right away, while I have to do it manually with the second one right ?
PhilGo20
That is correct.
Ignacio Vazquez-Abrams