TemplateSyntax Error - Invalid block tag '</span><span'.

213 views
Skip to first unread message

Joseph Mitchell

unread,
May 29, 2016, 7:24:17 PM5/29/16
to Django users
Hi,   newbie here.  While going through https://docs.djangoproject.com/en/1.9/intro/tutorial03/ and I get the following:

TemplateSyntaxError at /polls/
Invalid block tag on line 23: '</span><span'. Did you forget to register or load this tag?

My templates/polls/index.html file has:

{% if latest_question_list %}

    <ul>

    {% for question in latest_question_list %}

        <li><a href="/polls/{{ question.id }}/">{{ question.question_text }}</a></li>

    {% endfor %}

    </ul>

{% else %}

    <p>No polls are available.</p>

{% endif %}


And my views.py has:

from django.http import HttpResponse

from django.shortcuts import render


from .models import Question



def index(request):

    latest_question_list = Question.objects.order_by('-pub_date')[:5]

    context = {'latest_question_list': latest_question_list}

    return render(request, 'polls/index.html', context)


def detail(request, question_id):

    return HttpResponse("You're looking at question %s." % question_id)


def results(request, question_id):

    response = "You're looking at the results of question %s."

    return HttpResponse(response % question_id)


def vote(request, question_id):

    return HttpResponse("You're voting on question %s." % question_id)


I've searched this group as well as google.  No luck.

Any suggestions?  Thanks in advance, most appreciated! 

James Schneider

unread,
May 30, 2016, 2:07:38 AM5/30/16
to django...@googlegroups.com


On May 29, 2016 4:23 PM, "Joseph Mitchell" <joemit...@gmail.com> wrote:
>
> Hi,   newbie here.  While going through https://docs.djangoproject.com/en/1.9/intro/tutorial03/ and I get the following:
>
>> TemplateSyntaxError at /polls/
>> Invalid block tag on line 23: '</span><span'. Did you forget to register or load this tag?
>
>
> My templates/polls/index.html file has:
>

Do you have a parent template that contains <span> tags? It's likely that you forgot an {% endblock%} or {% endif %} somewhere. It may also be in your current template of you didn't post the entire file.

-James

Reply all
Reply to author
Forward
0 new messages