I have the following dictionary and I've returned this as part of my view
items = { 'studentlist' : [ {'name':'alice', 'value':22},
{'name':'bob', 'value':11},
{'name':'charlie', 'value':33} ] }
return items
and in my template I have:
<li tal:repeat="student studentlist" />
<a href="">${student.name}</a>
</li>
and it's returning an error. As far as I can see this is exactly the same as:
Trouble repeating elements using TAL, Chameleon and Pyramid
The error I'm getting is this, but as far as I can see the repeat should have a 'student' and 'name' is one such element, what's going wrong?
thanks for any help.
NameError: student
- Expression: "${student.name}"
- Filename: ... n2014_Neil\templates\neil.pt
- Location: (line 3: col 23)
- Source: <a href="">${student.name}</a>
^^^^^^^^^^^^^^^
- Arguments: request: <Request - at 0x54df9d0>
renderer_info: <RendererHelper - at 0x4bcbc10>
repeat: {...} (0)
renderer_name: templates/neil.pt
context: <DefaultRootFactory None at 0x54df3f0>
req: <Request - at 0x54df9d0>
studentlist: <list - at 0x54dd648>
view: <NeilViews - at 0x54df470>