/Django-Block-Render

Render just one block from a template, useful for AJAX (originally from django snippets 769 and 942)

Primary LanguagePython

Render a block from any template.

This is from Snippet 942 Which in turn was adapted from 769

Changes I've made:

  1. Reformat code style to PEP-8 (in progress; I'm learning).
  2. Fix problem with nested {% extends %} in django 1.3+, as per this comment on the 942 snippet.
  3. 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.