Fixed #20988 -- Added model meta option select_on_save

The option can be used to force pre 1.6 style SELECT on save behaviour.
This is needed in case the database returns zero updated rows even if
there is a matching row in the DB. One such case is PostgreSQL update
trigger that returns NULL.

Reviewed by Tim Graham.

Refs #16649
This commit is contained in:
Anssi Kääriäinen 2013-08-30 09:41:07 +03:00
parent 13be3bfef1
commit e973ee6a98
7 changed files with 130 additions and 16 deletions

View file

@ -22,7 +22,8 @@ DEFAULT_NAMES = ('verbose_name', 'verbose_name_plural', 'db_table', 'ordering',
'unique_together', 'permissions', 'get_latest_by',
'order_with_respect_to', 'app_label', 'db_tablespace',
'abstract', 'managed', 'proxy', 'swappable', 'auto_created',
'index_together', 'app_cache', 'default_permissions')
'index_together', 'app_cache', 'default_permissions',
'select_on_save')
@python_2_unicode_compatible
class Options(object):
@ -35,6 +36,7 @@ class Options(object):
self.ordering = []
self.unique_together = []
self.index_together = []
self.select_on_save = False
self.default_permissions = ('add', 'change', 'delete')
self.permissions = []
self.object_name, self.app_label = None, app_label