mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-14 05:36:50 +03:00
Save objects before assigning them in InheritedModelSerializationTests; Django 1.8 now throws an error when assigning unsaved objects to Foreign Key, GenericForeignKey, and OneToOneFields
This commit is contained in:
parent
a82a4d0a09
commit
b5128ca574
|
@ -48,8 +48,8 @@ class InheritedModelSerializationTests(TestCase):
|
||||||
Assert that a model with a onetoone field that is the primary key is
|
Assert that a model with a onetoone field that is the primary key is
|
||||||
not treated like a derived model
|
not treated like a derived model
|
||||||
"""
|
"""
|
||||||
parent = ParentModel(name1='parent name')
|
parent = ParentModel.objects.create(name1='parent name')
|
||||||
associate = AssociatedModel(name='hello', ref=parent)
|
associate = AssociatedModel.objects.create(name='hello', ref=parent)
|
||||||
serializer = AssociatedModelSerializer(associate)
|
serializer = AssociatedModelSerializer(associate)
|
||||||
self.assertEqual(set(serializer.data.keys()),
|
self.assertEqual(set(serializer.data.keys()),
|
||||||
set(['name', 'ref']))
|
set(['name', 'ref']))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user