Django Custom Inclusion Tags

后端 未结 4 520
太阳男子
太阳男子 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:07

    You forgot to close your template tags... Also, you should change the name in the for tag, you can't have for poll in poll:

      {% for p in poll %}
    • {{ p.pollquiz }}
    • {% endfor %}

    Also notice you're not using the inclusion tag you defined at all. I think you got some code mixed up, try to go over a tutorial start to end and things will be clearer.

提交回复
热议问题