Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added tests for accessing nullable ForeignKey after saving and fetchi…

…ng from the database (refs #8093).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3d918f41f50f1f1f756adbc77ed9575d6b475166 1 parent cd3def1
@gdub gdub authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/regressiontests/many_to_one_regress/models.py
View
10 tests/regressiontests/many_to_one_regress/models.py
@@ -84,6 +84,16 @@ def __unicode__(self):
>>> p.bestchild is None
True
+# bestchild should still be None after saving.
+>>> p.save()
+>>> p.bestchild is None
+True
+
+# bestchild should still be None after fetching the object again.
+>>> p = Parent.objects.get(name="Parent")
+>>> p.bestchild is None
+True
+
# Assigning None fails: Child.parent is null=False.
>>> c.parent = None
Traceback (most recent call last):

0 comments on commit 3d918f4

Please sign in to comment.
Something went wrong with that request. Please try again.