Ticket #4879: post_save_with_created_kw_r5991.patch
| File post_save_with_created_kw_r5991.patch, 1.0 kB (added by George Vilches <gav@thataddress.com>, 1 year ago) |
|---|
-
django_orig/django/db/models/base.py
old new 245 245 placeholders.append('(SELECT COUNT(*) FROM %s WHERE %s = %%s)' % \ 246 246 (qn(self._meta.db_table), qn(self._meta.order_with_respect_to.column))) 247 247 db_values.append(getattr(self, self._meta.order_with_respect_to.attname)) 248 record_exists = False 248 249 if db_values: 249 250 cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % \ 250 251 (qn(self._meta.db_table), ','.join(field_names), … … 259 260 transaction.commit_unless_managed() 260 261 261 262 # Run any post-save hooks. 262 dispatcher.send(signal=signals.post_save, sender=self.__class__, instance=self )263 dispatcher.send(signal=signals.post_save, sender=self.__class__, instance=self, created=(not record_exists)) 263 264 264 265 save.alters_data = True 265 266
