Django Custom Inclusion Tags

后端 未结 4 558
太阳男子
太阳男子 2021-01-19 01:33

I\'m trying to build my own template tags. I have no idea why I getting these errors. I\'m following the Django doc\'s.

This is my app\'s file structure:

         


        
4条回答
  •  甜味超标
    2021-01-19 02:31

    I found the problem. The problem was that the @register.inclusion_tag('show_pollquiz.html') inclusion tag is obviously looking for the template in the default_template directory. So that is why i got the error.

    According to me this is not clear in the documentation. But I guess its how it is, being a template and all...

    Oh , well.

    Now, how would I put the @register.inclusion_tag('show_pollquiz.html') to look in the same folder as the app? under templatetags/?

提交回复
热议问题