Eyes East

feed icon Subscribe / Latest posts / Latest links / Get in touch / About

Django Recipe: A template for any blog post

February 13, 2010 at 8:08 p.m.

One more quick code recipe before I jump back into the Journalism to Django series. In my last post, I mentioned that I set up permalinked paragraphs on a couple recent entries, using a different technique on each one. You might be wondering how I did that.

This is documented, but it took me a while before I realized how simple it is. The key is Django's get_template and select_template functions, which are part of the template system. Get template takes a string and gets a template. Select template chooses the first one that matches from a list or ...

Read more...