Django: common template subsections

Posted by Parand on Stack Overflow See other posts from Stack Overflow or by Parand
Published on 2010-06-01T17:27:15Z Indexed on 2010/06/01 17:53 UTC
Read the original article Hit count: 169

Filed under:
|

What's a good way to handle commonly occurring subsections of templates? For example, there is a sub-header section that's used across 4 different pages. The pages are different enough to not work well with template inheritance (ie. "extends" doesn't fit well).

Is "include" the recommended method here? It feels a bit heavyweight, requiring each subsection or snippet to be in its own file. Are there any performance issues in using include or is it smart about forming template from the subsections (ie. if I make extensive use of it, do I pay any penalties)?

I think what I'm looking for is something like template tags, but without the programming - a simple way to create a library of html template tags I can sprinkle in other templates.

© Stack Overflow or respective owner

Related posts about django

Related posts about django-templates