I am trying to create my own template tags. I have no idea why I get these errors. I follow the django docs.
This is my application file structure:
pollquiz/ __init__.py show_pollquiz.html showpollquiz.py
This is showpollquiz.py:
from django import template from pollquiz.models import PollQuiz, Choice register = template.Library() @register.inclusion_tag('show_pollquiz.html') def show_poll(): poll = Choice.objects.all() return { 'poll' : poll }
html file:
<ul> {% for poll in poll <li>{{ poll.pollquiz }}</li> {% endfor </ul>
in my base.html file, including how is it
{% load showpollquiz %} and {% poll_quiz %}
Bu, then I get the error:
Exception Value: Caught an exception while rendering: show_pollquiz.html
I have no idea why this is happening. Any ideas? Please keep in mind that I'm still new to Django
source share