Django Invalid block tag expected 'empty' or 'endfor'

Question:

I’m trying to display list of clinics but I keep getting the following error:

Exception Type: TemplateSyntaxError at /clinics/
Exception Value: Invalid block tag: 'c.name', expected 'empty' or 'endfor'

Here is the clinicList.html

{% for c in clinics %}
    {% c.name %}
{% endfor %}

here is the views

def clinicList(request):
    d = getVariables(request,dictionary={'page_name':""})
    d.update({'clinics': Clinic.objects.all()})

    return render(request, 'm1/clinicList.html', d)

here is url.py

url(r'^clinics/$', views.clinicList, name='clinicList'),
Asked By: James L.

||

Answers:

Looks like you should have {{ c.name }}

Answered By: jcfollower

In the clinicList.html

{% for c in clinics %}
    {{ c.name }}
{% endfor %}

I have the same issue, problem solved! 😀

Answered By: Manuel MÑ
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.