mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #25050 -- Allowed serialization of models with deferred fields.
This commit is contained in:
parent
7edd912cfb
commit
c6cce4de38
3 changed files with 11 additions and 2 deletions
|
@ -224,6 +224,13 @@ class SerializersTestBase(object):
|
|||
serial_str))
|
||||
self.assertEqual(deserial_objs[0].object.score, Approximate(3.4, places=1))
|
||||
|
||||
def test_deferred_field_serialization(self):
|
||||
author = Author.objects.create(name='Victor Hugo')
|
||||
author = Author.objects.defer('name').get(pk=author.pk)
|
||||
serial_str = serializers.serialize(self.serializer_name, [author])
|
||||
deserial_objs = list(serializers.deserialize(self.serializer_name, serial_str))
|
||||
self.assertIsInstance(deserial_objs[0].object, Author)
|
||||
|
||||
def test_custom_field_serialization(self):
|
||||
"""Tests that custom fields serialize and deserialize intact"""
|
||||
team_str = "Spartak Moskva"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue