Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django custom filters not working in included templates

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 known limitation/bug?

like image 374
Robin Elvin Avatar asked Jul 14 '10 11:07

Robin Elvin


1 Answers

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.

like image 112
Brant Avatar answered Sep 29 '22 18:09

Brant