Hi,

I was wondering if SQLFORM.grid can be used to display legacy tables
that don't contain a field called 'id', and if so, how?

I have this table definition:
db2.define_table('statuspoint',
     Field('pointnumber','integer'),
     Field('pointname','string'),
     Field('station','integer'),
     primarykey=['pointnumber'],
     migrate=False
)

The controller:
def grid():
    form = SQLFORM.grid(db2.statuspoint)
    return dict(form=form)

when called throws the error:
    query = query._id>0
  File "/home/xa21/web2py/gluon/dal.py", line 4916, in __getattr__
    return self[key]
  File "/home/xa21/web2py/gluon/dal.py", line 4860, in __getitem__
    return dict.__getitem__(self, str(key))
KeyError: '_id'

Thanks in advance, - Tom

Reply via email to