diff options
| author | Gary Wilson Jr <gary.wilson@gmail.com> | 2008-08-03 03:03:46 +0000 |
|---|---|---|
| committer | Gary Wilson Jr <gary.wilson@gmail.com> | 2008-08-03 03:03:46 +0000 |
| commit | 3d918f41f50f1f1f756adbc77ed9575d6b475166 (patch) | |
| tree | 9579c0b11569370721ed3c588b1415eb7e3a32db | |
| parent | cd3def1e4e3233a22098433a5efeaf371d3a2f89 (diff) | |
Added tests for accessing nullable ForeignKey after saving and fetching from the database (refs #8093).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | tests/regressiontests/many_to_one_regress/models.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/many_to_one_regress/models.py b/tests/regressiontests/many_to_one_regress/models.py index 57df8f3716..b87b36cb3b 100644 --- a/tests/regressiontests/many_to_one_regress/models.py +++ b/tests/regressiontests/many_to_one_regress/models.py @@ -84,6 +84,16 @@ True >>> 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): |
