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:
parent
cd3def1e4e
commit
3d918f41f5
|
@ -84,6 +84,16 @@ True
|
||||||
>>> p.bestchild is None
|
>>> p.bestchild is None
|
||||||
True
|
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.
|
# Assigning None fails: Child.parent is null=False.
|
||||||
>>> c.parent = None
|
>>> c.parent = None
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
|
|
Loading…
Reference in New Issue