aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/serializers.py
diff options
context:
space:
mode:
authorTom Christie2012-12-17 21:59:51 +0000
committerTom Christie2012-12-17 21:59:51 +0000
commitaa72f8d63d2a7b33a2e74eaba216b56c803af70c (patch)
tree80dd7156f68606ca0f85e3a9344cdfc58f2a0ae4 /rest_framework/serializers.py
parent70714c234630cd205ed88686ece3b594f387a48f (diff)
downloaddjango-rest-framework-aa72f8d63d2a7b33a2e74eaba216b56c803af70c.tar.bz2
Fix bug with M2M in browseable API
Diffstat (limited to 'rest_framework/serializers.py')
-rw-r--r--rest_framework/serializers.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 1d93f777..02377492 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -160,6 +160,9 @@ class BaseSerializer(Field):
for key in self.opts.exclude:
ret.pop(key, None)
+ for key, field in ret.items():
+ field.initialize(parent=self, field_name=key)
+
return ret
#####
@@ -174,13 +177,6 @@ class BaseSerializer(Field):
if parent.opts.depth:
self.opts.depth = parent.opts.depth - 1
- # We need to call initialize here to ensure any nested
- # serializers that will have already called initialize on their
- # descendants get updated with *their* parent.
- # We could be a bit more smart about this, but it'll do for now.
- for key, field in self.fields.items():
- field.initialize(parent=self, field_name=key)
-
#####
# Methods to convert or revert from objects <--> primitive representations.