python - Django 无效 block 标记应为 'empty' 或 'endfor'

标签 python django

我正在尝试显示诊所列表,但我不断收到以下错误:

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

这是 clinicList.html

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

这是观点

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

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

这里是url.py

url(r'^clinics/$', views.clinicList, name='clinicList'),

最佳答案

看起来你应该有 {{ c.name }}

关于python - Django 无效 block 标记应为 'empty' 或 'endfor',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27024009/

相关文章:

python - Python2 中的 dict.items() 和 dict.iteritems() 有什么区别?

python - 在绘图中显示 Y 轴网格线

python - 如何获取列中的最新时间戳?

python - Django/mySQL - 属性错误 : 'ForeignKey' object has no attribute 'IntegerField'

python - win32 : moving mouse with SetCursorPos vs. 鼠标事件

python - 调试我的代码

python - 需要多个值才能解包

jquery - django HttpResponseRedirect 没有重定向

python - 使用 __slots__ 有缺点吗?

python - Django获取PointField的坐标值