Ticket #10504: content_type_in_render_to_response.diff

File content_type_in_render_to_response.diff, 1.2 KB (added by bhagany, 6 years ago)
  • django/shortcuts/__init__.py

     
    1414    Returns a HttpResponse whose content is filled with the result of calling
    1515    django.template.loader.render_to_string() with the passed arguments.
    1616    """
    17     httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
     17    httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None),
     18                           'content_type': kwargs.pop('content_type', None)}
    1819    return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
    1920
    2021def _get_queryset(klass):
  • docs/topics/http/shortcuts.txt

     
    4848    The MIME type to use for the resulting document. Defaults to the value of
    4949    the :setting:`DEFAULT_CONTENT_TYPE` setting.
    5050
     51``content_type``
     52
     53    .. versionadded:: 1.1
     54
     55    An alias for ``mimetype`` that corresponds more closely to the HTTP header
     56    Content-Type.
     57
    5158Example
    5259-------
    5360
Back to Top