Sanitize serializer.data to remove hidden fields before rendering template JSON instance to raw data form.

* Fix lint issues
This commit is contained in:
elmccarthy 2017-07-10 03:43:36 -07:00 committed by Tom Christie
parent 39f6f1137c
commit b905197f24

View File

@ -556,7 +556,10 @@ class BrowsableAPIRenderer(BaseRenderer):
accepted = self.accepted_media_type accepted = self.accepted_media_type
context = self.renderer_context.copy() context = self.renderer_context.copy()
context['indent'] = 4 context['indent'] = 4
content = renderer.render(serializer.data, accepted, context) data = {k: v for (k, v) in serializer.data.items()
if not isinstance(serializer.fields[k],
serializers.HiddenField)}
content = renderer.render(data, accepted, context)
else: else:
content = None content = None