1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #18599 -- Added a test for assigning a GenericForeignKey in Model.__init__().

The issue was fixed by 8a47ba679d
(refs #16508).
This commit is contained in:
Bouke Haarsma 2016-05-13 18:42:54 -04:00 committed by Tim Graham
parent 094ea69e07
commit 31501fb53e

View File

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