Skip to content

Entries published on June 7, 2006

1 entry published on this date. See also: all entries published in June 2006, full archive.

Django tips: Write better template tags

Django‘s template tags are a great way to handle things that don’t always make sense being in a view. If you want to have, say, a list of recently-added content which appears in a sidebar or footer on every page of a site, it’d be crazy to manually change every view to fetch that content and add it to the template context; a template tag is definitely the way to go.

For example, in the footer of every page on this site, I pull out the five most recent entries, five most recent links and five most recent comments, and …

Entry published June 7, 2006. Read full entry.