1
0
mirror of https://github.com/django/django.git synced 2025-10-30 17:16:10 +00:00

[1.8.x] Fixed #25715 -- Fixed Model.refresh_from_db() with ForeignKey w/on_delete=SET_NULL.

Backport of 54e2e688e1 from master
This commit is contained in:
Tim Graham
2015-11-20 10:31:33 -05:00
parent bc8bae0ba9
commit 2179e5a2bc
4 changed files with 16 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ class ArticleSelectOnSave(Article):
class SelfRef(models.Model):
selfref = models.ForeignKey('self', null=True, blank=True,
related_name='+')
article = models.ForeignKey(Article, on_delete=models.SET_NULL, null=True, blank=True)
def __str__(self):
# This method intentionally doesn't work for all cases - part