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
This commit is contained in:
Gary Wilson Jr 2008-08-03 03:03:46 +00:00
parent cd3def1e4e
commit 3d918f41f5
1 changed files with 10 additions and 0 deletions

View File

@ -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):