|
@@ -3,31 +3,14 @@ This module collects helper functions and classes that "span" multiple levels
|
|
of MVC. In other words, these functions/classes introduce controlled coupling
|
|
of MVC. In other words, these functions/classes introduce controlled coupling
|
|
for convenience's sake.
|
|
for convenience's sake.
|
|
"""
|
|
"""
|
|
-import warnings
|
|
|
|
-
|
|
|
|
from django.http import (
|
|
from django.http import (
|
|
Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect,
|
|
Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect,
|
|
)
|
|
)
|
|
from django.template import loader
|
|
from django.template import loader
|
|
from django.urls import NoReverseMatch, reverse
|
|
from django.urls import NoReverseMatch, reverse
|
|
-from django.utils.deprecation import RemovedInDjango30Warning
|
|
|
|
from django.utils.functional import Promise
|
|
from django.utils.functional import Promise
|
|
|
|
|
|
|
|
|
|
-def render_to_response(template_name, context=None, content_type=None, status=None, using=None):
|
|
|
|
- """
|
|
|
|
- Return 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 of 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)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def render(request, template_name, context=None, content_type=None, status=None, using=None):
|
|
def render(request, template_name, context=None, content_type=None, status=None, using=None):
|
|
"""
|
|
"""
|
|
Return a HttpResponse whose content is filled with the result of calling
|
|
Return a HttpResponse whose content is filled with the result of calling
|