﻿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
28331	Add an extra_context attribute to class-based generic views that use ContextMixin (e.g. TemplateView)	Jeremy	Bruno Alla	"It used to be possible to pass extra_context to direct_to_template.  Then direct_to_template was replaced with TemplateView.as_view ... but the latter function never got the ability to take an extra_context arg.

As a result there are now many many re-implementations of some variation of the following:


{{{
class StaticPageView(TemplateView):
    context = None

    def get_context_data(self, **kwargs):
        context = super(StaticPageView, self).get_context_data(**kwargs)
        context.update(self.context or {})
        return context


}}}
You can find them across the web, across StackOverflow, etc.  Everyone has to remake this one small class just so that they can pass an extra context to template-only views.

This is counter-productive: the whole point of a framework is to *prevent* everyone from having to re-invent the same code.  Adding yet another re-implementation of StaticPageView does nothing to improve the code, it only clutters it up with boilerplate.

Please fix this by allowing as_view (ideally in all generic views) to take an extra_context arg."	Cleanup/optimization	closed	Generic views	1.11	Normal	fixed			Accepted	1	1	0	0	1	0
