mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 21:24:33 +03:00
Stop serialization from going back to base object
Without this patch the base object will be recursed back into with each related object at least once.
This commit is contained in:
parent
943bc073d9
commit
f3834aa241
|
@ -210,6 +210,9 @@ class Serializer(object):
|
||||||
Given a model instance or dict, serialize it to a dict..
|
Given a model instance or dict, serialize it to a dict..
|
||||||
"""
|
"""
|
||||||
data = {}
|
data = {}
|
||||||
|
# Append the instance itself to the stack so that you never iterate
|
||||||
|
# back into the first object.
|
||||||
|
self.stack.append(instance)
|
||||||
|
|
||||||
fields = self.get_fields(instance)
|
fields = self.get_fields(instance)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user