I cannot reproduce the error with trunk. Yet this does not do what you expect:
db.subroute.route.writable = False To make the table routes not editable you should do: grid = SQLFORM.smartgrid(db.route, editable={'routes':False}) On Wednesday, 3 July 2013 14:50:09 UTC-5, Otto DomÃnguez wrote: > > I have a working app since web2py 1.99 times, and I have been upgrading to > later versions periodically. Today I noticed my app does not work in 2.5.1 > in some simple uses of SQLFORM.smartgrid. I took time this morning to check > versions from 2.3.2 up to latest to check in which version it stopped > working. It works up to 2.4.2. In 2.4.3 it does not, up to the latest > 2.5.1. In the non working versions the ticket message is the same, so the > code should have been introduced in 2.4.3. The message reads: > 'Table' object has no attribute 'content_of_some_parent_field' > > Take this simple model: > > db.define_table('route', > Field('route', label=T('Route')), > format='%(route)s') > > db.define_table('subroute', > Field('subroute', label=T('Subroute')), > Field('route', 'reference route', label=T('Route')), > format=lambda subroute: '%s-%s' % (db.route[subroute.route].route, > subroute.subroute)) > > Take this simple route.py controller: > > @auth.requires_membership('Manager') > def index(): > db.subroute.route.writable = False > grid = SQLFORM.smartgrid(db.route) > return locals() > > Navigate to localhost:8000/appname/route. Create a route (parent record). > Click subroute (child link). Add subroute (child record). Now the grid is > showing the subroute (child) with an active link to its route (parent). > Click this link. It works on or below 2.4.2. It does not work on or above > 2.4.3. When working, it allows to view/edit/delete the parent. > > Should I file a bug or this is a known bug/expected behavior? > -- --- 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.