1

I have my custom template tag. How to load it at once, without {% load tag %} in every template-file?

UPD:

As suggested by Yuji:

from django.template.loader import add_to_builtins
add_to_builtins('myapp.templatetags.mytagslib')

however, I don't use django, only templates - what should i write instead of myapp.templatetags.mytagslib?

UPD2: ok, tried django.templatetags..., works ;-)

Vladimir Keleshev
  • 13,753
  • 17
  • 64
  • 93
  • I think you have to use that in every file. I'm not aware of a way around that. (EDIT: But now I am... see Yuji's answer.) – dappawit Mar 07 '11 at 23:46

1 Answers1

3

Here you go:

Load a Django template tag library for all views by default

Favorite Django Tips & Features?

I will remember this one, thanks :)

Community
  • 1
  • 1
Yuji 'Tomita' Tomita
  • 115,817
  • 29
  • 282
  • 245