aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/serializer.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/serializer.py')
-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)