﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12669	Return different HttpResponse from direct_to_template	Kyle Dodson	nobody	"I've attached a patch that allows one to change the type of HttpResponse returned by the '''django.views.generic.simple.direct_to_template''' generic view. For example,

{{{
#!python
from django.http import HttpResponseForbidden
from django.views.generic.simple import direct_to_template

def forbidden_view(request):
    extra = {
        ""some"": ""extra_parameter"",
    }
    return direct_to_template(request, ""custom/forbidden.html"", extra_context=extra, response=HttpResponseForbidden)
}}}

I'm currently writing an application with a rather convoluted set of permissions (not by my choice) and having to render and return many ''different'' 403 forbidden pages. A lot of my ''different'' 403 forbidden pages need more (and dynamic) data embedded in them. I wrote a simple generic view to do this, and it took me a few minutes to realize I'd duplicated the '''direct_to_template''' view but substituted !HttpResponseForbidden for HttpResponse."		closed	Generic views			fixed			Accepted	1	0	1	0	0	0
