Commit 3d918f41 authored by Gary Wilson Jr's avatar Gary Wilson Jr
Browse files

Added tests for accessing nullable ForeignKey after saving and fetching from...

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
parent cd3def1e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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):