Ticket #1504: __init__.py.2.diff

File __init__.py.2.diff, 791 bytes (added by Rob van der Linde, 17 years ago)

Add support for mimetype in render_to_response() function

  • __init__.py

    old new  
    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     return HttpResponse(loader.render_to_string(*args, **kwargs))
     17    if "mimetype" in kwargs:
     18        mimetype = kwargs["mimetype"]
     19        del kwargs["mimetype"]
     20        return HttpResponse(loader.render_to_string(*args, **kwargs), mimetype=mimetype)
     21    else:
     22        return HttpResponse(loader.render_to_string(*args, **kwargs))
    1823load_and_render = render_to_response # For backwards compatibility.
    1924
    2025def _get_queryset(klass):
Back to Top