I always read that I should use
model = Model(a=5, b=6)
model.save()
But I just saw there is a manager function create, because I saw an opensource django app using it.
model = Model.objects.create(a=5, b=6)
print model.pk
1
So is it suggested to use it? Or is it still preferred to use the .save method. I’m guessing that objects.create will try to create it no matter what, whereas save may save an existing object if the pk is specified.
These are the docs that I found: https://docs.djangoproject.com/en/dev/topics/db/queries/#creating-objects
It’s in the page “QuerySet API reference”, linked from the documentation index.