Ticket #4879: post_save_with_created_kw.patch
| File post_save_with_created_kw.patch, 1.1 kB (added by gav@thataddress.com, 1 year ago) |
|---|
-
django_orig/django/db/models/base.py
old new 241 241 placeholders.append('(SELECT COUNT(*) FROM %s WHERE %s = %%s)' % \ 242 242 (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.order_with_respect_to.column))) 243 243 db_values.append(getattr(self, self._meta.order_with_respect_to.attname)) 244 record_exists = False 244 245 if db_values: 245 246 cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % \ 246 247 (backend.quote_name(self._meta.db_table), ','.join(field_names), … … 256 257 transaction.commit_unless_managed() 257 258 258 259 # Run any post-save hooks. 259 dispatcher.send(signal=signals.post_save, sender=self.__class__, instance=self )260 dispatcher.send(signal=signals.post_save, sender=self.__class__, instance=self, created=(not record_exists)) 260 261 261 262 save.alters_data = True 262 263
