views:

127

answers:

0

Hello

I can't seems to work out how to fill the toscawidgets DataGrid.

In my controller I have:

dgfileds = [('Email Address', 'email'),  ('Logon ID', 'id')]

c.data = [ dict(email ='[email protected]',  id='1'),  
             dict(email ='[email protected]',  id='2')
           ]
c.grid = twf.DataGrid(fields=dgfileds)

In my mako template I have:

<p>${c.grid( c.data)}</p>

I get this error in the template:

File '/usr/lib/python2.6/site-packages/tw/forms/templates/datagrid.html', line 13 in <Expression u"col.get_field(row, displays_on='genshi')">
<td py:for="col in columns"
File '/usr/lib/python2.6/site-packages/tw/forms/datagrid.py', line 67 in get_field
return self.getter(row)
File '/usr/lib/python2.6/site-packages/tw/forms/datagrid.py', line 28 in __call__
obj = getattr(obj, name)
AttributeError: 'dict' object has no attribute 'email'

What data structure does the DataGrid take, any pointers appreciated.