开发者

Django custom filters not working in included templates

开发者 https://www.devze.com 2023-01-07 07:09 出处:网络
Not sure if I\'ve done something wrong but if I try to use a custom filter in an included template fragment I\'m getting \"invalid filter\"

Not sure if I've done something wrong but if I try to use a custom filter in an included template fragment I'm getting "invalid filter"

If I try the filter on the main template it works fine.

Is this a k开发者_C百科nown limitation/bug?


You'll need to {% load %} in the included template as well.

So, if base.html is calling {% include "sub.html" %}, then you'll need to have the {% load custom_filters %} tag at the top of sub.html as well.

0

精彩评论

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

关注公众号