aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Barrett2012-09-19 13:43:36 -0700
committerMichael Barrett2012-09-19 13:43:36 -0700
commitf3834aa241ba6b6e922e324092dc2d6e7e343e72 (patch)
tree4b9972ffbe6c55040f67baa468e9760c082a26c9
parent943bc073d986b1d5bc10c6d17d3601d4311c3681 (diff)
downloaddjango-rest-framework-f3834aa241ba6b6e922e324092dc2d6e7e343e72.tar.bz2
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.
-rw-r--r--djangorestframework/serializer.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/djangorestframework/serializer.py b/djangorestframework/serializer.py
index 5d77c461..d2349b53 100644
--- a/djangorestframework/serializer.py
+++ b/djangorestframework/serializer.py
@@ -210,6 +210,9 @@ class Serializer(object):
Given a model instance or dict, serialize it to a dict..
"""
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)