Those reading this via a feed reader will have to view the page on my blog as I am using embedded gists. I’ll find a solution for that in the future.
So say you have a base template that looks something like:
And a template that looks like either of these:
It used to be that you could write something like this:
But generic function based views are deprecated and the world is being strongly urged to move to generic class based views. If you would like to get extra_content working with the direct_to_template replacement TemplateView, you can use a view like the following:
And a urls.py like the following using it:
The code used in this blog post can be found in this gist.