1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

[1.6.x] 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

Backport of e973ee6a98 from master

Conflicts:
	django/db/models/options.py
	tests/basic/tests.py
This commit is contained in:
Anssi Kääriäinen
2013-08-30 09:41:07 +03:00
parent cd10e998b6
commit 76e38a2177
7 changed files with 130 additions and 16 deletions

View File

@@ -19,6 +19,11 @@ class Article(models.Model):
def __str__(self):
return self.headline
class ArticleSelectOnSave(Article):
class Meta:
proxy = True
select_on_save = True
@python_2_unicode_compatible
class SelfRef(models.Model):
selfref = models.ForeignKey('self', null=True, blank=True,