This is from Snippet 942 Which in turn was adapted from 769
- Reformat code style to PEP-8 (in progress; I'm learning).
- Fix problem with nested
{% extends %}
in django 1.3+, as per this comment on the 942 snippet. - Refactor
_render_template_block_nodelist
for neater handling of exceptions (todo)
The description in snippet 769 has some usage examples, and this StackOverflow thread also provides an example.