Commit fe96cece by Ollie Ford Committed by Tom Christie

fixes response rendering with empty context (#4495)

This commit allows `response.render` to be called when
`response.rendered_context == {}`. This should be allowed, since
if [the JSONRenderer, for example](https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/renderers.py#L85-L92) receives a `None` context, it
sets it to an empty dictionary itself.
parent fe4c4fa7
......@@ -56,7 +56,7 @@ class Response(SimpleTemplateResponse):
assert renderer, ".accepted_renderer not set on Response"
assert accepted_media_type, ".accepted_media_type not set on Response"
assert context, ".renderer_context not set on Response"
assert context is not None, ".renderer_context not set on Response"
context['response'] = self
media_type = renderer.media_type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment