summaryrefslogtreecommitdiff
path: root/tests/generic_relations
diff options
context:
space:
mode:
authorBouke Haarsma <bouke@webatoom.nl>2016-05-13 18:42:54 -0400
committerTim Graham <timograham@gmail.com>2016-05-13 21:26:48 -0400
commit31501fb53e0987d0e3ddb1eaddd4ccee1feae407 (patch)
tree3d00ba8d71949be454697c1b6d417d671cf48df5 /tests/generic_relations
parent094ea69e072779661d36e46a6caec0fea4b3ca16 (diff)
downloaddjango-31501fb53e0987d0e3ddb1eaddd4ccee1feae407.tar.gz
Refs #18599 -- Added a test for assigning a GenericForeignKey in Model.__init__().
The issue was fixed by 8a47ba679d2da0dee74671a53ba0cd918b433e34 (refs #16508).
Diffstat (limited to 'tests/generic_relations')
-rw-r--r--tests/generic_relations/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py
index c22a6ef7e0..ca029c6050 100644
--- a/tests/generic_relations/tests.py
+++ b/tests/generic_relations/tests.py
@@ -572,6 +572,11 @@ id="id_generic_relations-taggeditem-content_type-object_id-1-id" /></p>""" % tag
tag.object_id = cauliflower.id
self.assertEqual(tag.content_object, cauliflower)
+ def test_assign_content_object_in_init(self):
+ spinach = Vegetable(name="spinach")
+ tag = TaggedItem(content_object=spinach)
+ self.assertEqual(tag.content_object, spinach)
+
class CustomWidget(forms.TextInput):
pass