mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 08:14:16 +03:00
Sanitize serializer.data to remove hidden fields before rendering template JSON instance to raw data form. * Fix lint issues
This commit is contained in:
parent
39f6f1137c
commit
b905197f24
|
@ -556,7 +556,10 @@ class BrowsableAPIRenderer(BaseRenderer):
|
|||
accepted = self.accepted_media_type
|
||||
context = self.renderer_context.copy()
|
||||
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:
|
||||
content = None
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user