Unfortunately it seems to be a web2py grid/smartgrid bug. I opened a ticket here: http://code.google.com/p/web2py/issues/detail?id=1851
Meanwhile please note that defining an old style virtual field does not break the smartgrid: class MyVirtualFields(object): def testfield(self): return 'foo' db.testtable.virtualfields.append(MyVirtualFields()) I'll make a few updates to web2py with this occasion :) Thanks, -rif vineri, 10 ianuarie 2014, 01:28:37 UTC+2, Manuele a scris: > > Il 10/09/12 15:49, rif ha scritto: > > I started the development of a new django-like admin interface. > > > > You can find it here: https://github.com/rif/web2admin > > > > It is very basic but still usable because it uses SQLFORM.smartgrid. > > > > I am announcing it early because I need your feedback and feature > > requests so that I can find out if grid will be able to support all > > the desired features. > > > > For quick start you can create a w2a_root group and add your user to > > that group. > > > > -rif > > -- > > > > > > > Dear rif, > many compliments for the project! > I found a problem with virtual fields... but I don't know if it's > related to your plugin or directly to web2py. > I added a very simple virtual field like this one: > > db.testtable.testfield = Field.Virtual(lambda row: 'foo') > > and I obtain this error: > > Traceback (most recent call last): > File "/home/manuele/portali/web2py.git/gluon/restricted.py", line 217, > in restricted > exec ccode in environment > File > "/home/manuele/portali/web2py.git/applications/paytorviewer/controllers/plugin_web2admin.py", > > > line 116, in <module> > File "/home/manuele/portali/web2py.git/gluon/globals.py", line 372, in > <lambda> > self._caller = lambda f: f() > File "/home/manuele/portali/web2py.git/gluon/tools.py", line 3239, in f > return action(*a, **b) > File > "/home/manuele/portali/web2py.git/applications/paytorviewer/controllers/plugin_web2admin.py", > > > line 34, in view_table > showbuttontext = plugins.web2admin.showbuttontext, > File "/home/manuele/portali/web2py.git/gluon/sqlhtml.py", line 2770, > in smartgrid > user_signature=user_signature, **kwargs) > File "/home/manuele/portali/web2py.git/gluon/sqlhtml.py", line 2452, > in grid > value = row[str(field)] > File "/home/manuele/portali/web2py.git/gluon/dal.py", line 7362, in > __getitem__ > raise ae > AttributeError: 'Row' object has no attribute 'unknown' > > any idea? > > Thank you > > Manuele > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.