Skip to content

Commit 3bf5dfd

Browse files
committed
Fix template.render deprecation warnings for 1.9+
1 parent 04158e1 commit 3bf5dfd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

rest_framework/renderers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,12 @@ def render(self, data, accepted_media_type=None, renderer_context=None):
672672

673673
template = loader.get_template(self.template)
674674
context = self.get_context(data, accepted_media_type, renderer_context)
675-
context = RequestContext(renderer_context['request'], context)
676-
ret = template.render(context)
675+
676+
if django.VERSION < (1, 9):
677+
context = RequestContext(renderer_context['request'], context)
678+
ret = template.render(context)
679+
else:
680+
ret = template.render(context, request=renderer_context['request'])
677681

678682
# Munge DELETE Response code to allow us to return content
679683
# (Do this *after* we've rendered the template so that we include

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy