summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-02-11 05:49:04 -0500
committerGitHub <noreply@github.com>2017-02-11 05:49:04 -0500
commit7b6e42089c9d5ff2dcbfee4005f72cd42728222e (patch)
treeca0aec79f200f8abd7a1c2610b2e5b700627c582 /django
parent0166dd2f8c54b62a65735c395825b66eeb39788c (diff)
Fixed #25978 -- Deprecated shorcuts.render_to_response().
Diffstat (limited to 'django')
-rw-r--r--django/shortcuts.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/django/shortcuts.py b/django/shortcuts.py
index 04e2f3e103..c489ecd5cd 100644
--- a/django/shortcuts.py
+++ b/django/shortcuts.py
@@ -3,11 +3,14 @@ This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
+import warnings
+
from django.http import (
Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect,
)
from django.template import loader
from django.urls import NoReverseMatch, reverse
+from django.utils.deprecation import RemovedInDjango30Warning
from django.utils.encoding import force_text
from django.utils.functional import Promise
@@ -17,6 +20,11 @@ def render_to_response(template_name, context=None, content_type=None, status=No
Returns a HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments.
"""
+ warnings.warn(
+ 'render_to_response() is deprecated in favor render(). It has the '
+ 'same signature except that it also requires a request.',
+ RemovedInDjango30Warning, stacklevel=2,
+ )
content = loader.render_to_string(template_name, context, using=using)
return HttpResponse(content, content_type, status)