...grid(....fields=['name']...) should be
...grid(....fields=[db.special.name]...) which web2py version? I though we support both syntaxes. Please open a ticket. On Oct 21, 9:19 am, Omi Chiba <[email protected]> wrote: > I have a following entry in controller and this works fine to list all > the fields in a table. > When I specify fields=['name'], then I got an error. What did I do > wrong ? > > Here's my table: > --------------------------------- > db.define_table('special', > Field('restaurant_id', db.restaurant), > Field('name'), > Field('price','double'), > Field('image','upload'), > format='%(name)s') > > Controller (This works) > ------------------------------- > def update(): > grid = SQLFORM.grid(db.special.restaurant_id==request.args(0), > deletable=False,paginate=10,details=False,csv=False,searchable=False) > return dict(grid=grid) > > Controller(This doesn't) > -------------------------------- > def update(): > grid = > SQLFORM.grid(db.special.restaurant_id==request.args(0),fields=['name'],dele > table=False, > paginate=10,details=False,csv=False,searchable=False) > return dict(grid=grid) > > Error: > ------------------------------- > Traceback (most recent call last): > File "C:\web2py\gluon\restricted.py", line 194, in restricted > exec ccode in environment > File "C:/web2py/applications/Kyono_Lunch/controllers/default.py", > line 88, in <module> > File "C:\web2py\gluon\globals.py", line 149, in <lambda> > self._caller = lambda f: f() > File "C:\web2py\gluon\tools.py", line 2456, in f > return action(*a, **b) > File "C:/web2py/applications/Kyono_Lunch/controllers/default.py", > line 23, in update > grid = > SQLFORM.grid(db.special.restaurant_id==request.args(0),deletable=False, > paginate=10,details=False,csv=False,searchable=False,fields=['id']) > File "C:\web2py\gluon\sqlhtml.py", line 1588, in grid > if not field.readable: continue > AttributeError: 'str' object has no attribute 'readable'

