开发者

Loading django custom template tag at onece

开发者 https://www.devze.com 2023-02-15 04:56 出处:网络
I have my custom template tag. How to load it at once, without {% load tag %} in every template-file?

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 ;-)


Here you go:

Load a Django template tag library for all views by default

Favorite Django Tips & Features?

I will remember this one, thanks :)

0

精彩评论

暂无评论...
验证码 换一张
取 消