Created by dan on Thursday 18th February, 2010 at 5:12 PM
Tags: Django, Python, Web development
I'm not entirely sure of how well this is documented on Django's part, however using the {% load %} tag on each page template where tags and filters used surely break the DRY principle? Anyway, there is an easier way to load tags and filters for all templates.
There's just a couple of lines required to include a template tag or filter library, and you can include more than one library if you so require (like I do). Simply place the code below in to your __init__.py file and off you go...
from django.template import add_to_builtins
add_to_builtins('path.to.templatetags.tags.py')
It is my understanding that you can place this in whichever __init__.py file you wish, however it'll only load the tags or filters to views, which are at the same level or below the __init__.py file you place the lines in.