TGTGInsighttelegram intelligenceLIVE / telegram public index
← djangoproject
djangoproject avatar

TGINSIGHT POST

Post #428

@djangoproject

djangoproject

Views210Post view count
PostedAug 3008/30/2017, 03:40 AM
Post content

Post content

How #Django knows to #UPDATE vs. #INSERT when you call #save (), #Django follows this algorithm: If the object’s primary key attribute is set to a value that evaluates to True (i.e., a value other than None or the empty string), Django executes an UPDATE. If the object’s primary key attribute is not set or if the UPDATE didn’t update anything, Django executes an INSERT.