aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2012-09-27 05:49:34 -0700
committerTom Christie2012-09-27 05:49:34 -0700
commitb2259bad6b60587fe06810c2b7ab5eee9e277c9b (patch)
tree106c3ffb7d0a5f30ea515d7e7712516b9e0b1fed
parent49d2ea7cc0fa960ca3a98c90e8829ffebdcc1570 (diff)
parentf3834aa241ba6b6e922e324092dc2d6e7e343e72 (diff)
downloaddjango-rest-framework-b2259bad6b60587fe06810c2b7ab5eee9e277c9b.tar.bz2
Merge pull request #270 from phobologic/master
Prevent serialization from recursing to self
-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)