summaryrefslogtreecommitdiff
path: root/django/shortcuts.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-03 22:01:30 -0400
committerTim Graham <timograham@gmail.com>2015-09-23 19:31:11 -0400
commit9023696613b278bb96a2ab5744da5c2bac023ad7 (patch)
tree5e088d65e7850758c823422513714757ea5c1485 /django/shortcuts.py
parentb3641512c891b653887a90eca8cd3f987682950f (diff)
Removed dictionary and context_instance parameters for render functions.
Per deprecation timeline.
Diffstat (limited to 'django/shortcuts.py')
-rw-r--r--django/shortcuts.py46
1 files changed, 5 insertions, 41 deletions
diff --git a/django/shortcuts.py b/django/shortcuts.py
index 8ff39c08ba..b5f20b832c 100644
--- a/django/shortcuts.py
+++ b/django/shortcuts.py
@@ -10,63 +10,27 @@ from django.db.models.query import QuerySet
from django.http import (
Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect,
)
-from django.template import RequestContext, loader
-from django.template.engine import (
- _context_instance_undefined, _dictionary_undefined
-)
+from django.template import loader
from django.utils import six
from django.utils.encoding import force_text
from django.utils.functional import Promise
-def render_to_response(template_name, context=None,
- context_instance=_context_instance_undefined,
- content_type=None, status=None,
- dictionary=_dictionary_undefined, using=None):
+def render_to_response(template_name, context=None, content_type=None, status=None, using=None):
"""
Returns a HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments.
"""
- if (context_instance is _context_instance_undefined
- and dictionary is _dictionary_undefined):
- # No deprecated arguments were passed - use the new code path
- content = loader.render_to_string(template_name, context, using=using)
-
- else:
- # Some deprecated arguments were passed - use the legacy code path
- content = loader.render_to_string(
- template_name, context, context_instance, dictionary,
- using=using)
-
+ content = loader.render_to_string(template_name, context, using=using)
return HttpResponse(content, content_type, status)
-def render(request, template_name, context=None,
- context_instance=_context_instance_undefined,
- content_type=None, status=None,
- dictionary=_dictionary_undefined,
- using=None):
+def render(request, template_name, context=None, content_type=None, status=None, using=None):
"""
Returns a HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments.
- Uses a RequestContext by default.
"""
- if (context_instance is _context_instance_undefined
- and dictionary is _dictionary_undefined):
- # No deprecated arguments were passed - use the new code path
- # In Django 1.10, request should become a positional argument.
- content = loader.render_to_string(
- template_name, context, request=request, using=using)
- else:
- # Some deprecated arguments were passed - use the legacy code path
- if context_instance is not _context_instance_undefined:
- pass
- else:
- context_instance = RequestContext(request)
- content = loader.render_to_string(
- template_name, context, context_instance, dictionary,
- using=using)
-
+ content = loader.render_to_string(template_name, context, request, using=using)
return HttpResponse(content, content_type, status)