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.
This commit is contained in:
Ollie Ford 2016-09-17 03:13:34 +01:00 committed by Tom Christie
parent fe4c4fa751
commit fe96ceced0

View File

@ -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