diff options
Diffstat (limited to 'django/shortcuts.py')
| -rw-r--r-- | django/shortcuts.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/django/shortcuts.py b/django/shortcuts.py index 3bb2412526..bbfc99299f 100644 --- a/django/shortcuts.py +++ b/django/shortcuts.py @@ -25,7 +25,7 @@ from django.utils.functional import Promise def render_to_response(template_name, context=None, context_instance=_context_instance_undefined, content_type=None, status=None, dirs=_dirs_undefined, - dictionary=_dictionary_undefined): + dictionary=_dictionary_undefined, using=None): """ Returns a HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments. @@ -34,12 +34,13 @@ def render_to_response(template_name, context=None, and dirs is _dirs_undefined and dictionary is _dictionary_undefined): # No deprecated arguments were passed - use the new code path - content = loader.render_to_string(template_name, context) + 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, dirs, dictionary) + template_name, context, context_instance, dirs, dictionary, + using=using) return HttpResponse(content, content_type, status) @@ -47,7 +48,8 @@ def render_to_response(template_name, context=None, def render(request, template_name, context=None, context_instance=_context_instance_undefined, content_type=None, status=None, current_app=_current_app_undefined, - dirs=_dirs_undefined, dictionary=_dictionary_undefined): + dirs=_dirs_undefined, dictionary=_dictionary_undefined, + using=None): """ Returns a HttpResponse whose content is filled with the result of calling django.template.loader.render_to_string() with the passed arguments. @@ -59,7 +61,8 @@ def render(request, template_name, context=None, and dictionary is _dictionary_undefined): # No deprecated arguments were passed - use the new code path # In Django 2.0, request should become a positional argument. - content = loader.render_to_string(template_name, context, request=request) + content = loader.render_to_string( + template_name, context, request=request, using=using) else: # Some deprecated arguments were passed - use the legacy code path @@ -80,7 +83,8 @@ def render(request, template_name, context=None, context_instance._current_app = current_app content = loader.render_to_string( - template_name, context, context_instance, dirs, dictionary) + template_name, context, context_instance, dirs, dictionary, + using=using) return HttpResponse(content, content_type, status) |
