I realize that templatetags are mainly used specific to applications which are INSTALLED_APPS, such as articles/templatetags/, but in my case I need tags for generic things such as navigation which doesn’t have an application.
I’m currently keeping templatetags in my project dir. and in order for it to get picked up I added my project to INSTALLED_APPS – this works but I’m not sure if this was the right thing to do – are there any downsides?
I would do it the same way Django provides its additional template tags, i.e. creating an own package/application(
django.contrib.humanize,django.contrib.markup,django.contrib.webdesign)These are just three “normal” packages, that have a
templatetagspackage inside. The name of the module insidetempaltetagsis the same as the package/application name (e.g.humanize.py).Then put it somewhere where Python can find it.
You could also create some kind of “meta” package
templatetagsand put everything there, e.g.Of course you have to add those to you
INSTALLED_APPS(e.g.templatetags.navigation) and load them in your template (e.g.{% load navigation %}).