Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django save vs create

Model.save() does either INSERT or UPDATE of an object in a DB, 
Model.objects.create() does only INSERT.

Model.save()
UPDATE If the object’s primary key attribute is set to a value that evaluates to True
INSERT If the object’s primary key attribute is not set 
or if the UPDATE didn’t update anything 
(e.g. if primary key is set to a value that doesn’t exist in the database).
 
PREVIOUS NEXT
Tagged: #django #save #create
ADD COMMENT
Topic
Name
9+8 =