Thank you for clarifying. I've taken the latest version off github and I'm still having issues. Works if linked_tables is a list, but not as a dict.
# db model db.define_table('supply', Field('test'), format='%(test)s') db.define_table('job', Field('test'), Field('supply', 'reference supply'), format='%(test)s') db.define_table('count', Field('test'), Field('job', 'reference job')) # index controller @auth.requires_login() def test(): form = SQLFORM.smartgrid(db.supply, fields=dict(supply=[db.supply.id]), linked_tables=dict(supply='job')) return dict(test=form) <type 'exceptions.ValueError'> Field job not in table Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Traceback (most recent call last): File "/Users/.../Projects/web2py/gluon/restricted.py", line 212, in restricted exec ccode in environment File "/Users/.../Projects/web2py/applications/welcome/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/welcome/controllers/default.py>, line 82, in <module> File "/Users/.../Projects/web2py/gluon/globals.py", line 193, in <lambda> self._caller = lambda f: f() File "/Users/.../Projects/web2py/gluon/tools.py", line 3055, in f return action(*a, **b) File "/Users/.../Projects/web2py/applications/welcome/controllers/default.py", line 26, in test form = SQLFORM.smartgrid(db.supply, fields=dict(supply=[db.supply.id]), linked_tables=dict(supply='job')) File "/Users/.../Projects/web2py/gluon/sqlhtml.py", line 2639, in smartgrid raise ValueError('Field %s not in table' %fld) ValueError: Field job not in table On Saturday, July 27, 2013 9:23:03 PM UTC+12, Massimo Di Pierro wrote: > > "trunk" is the development version of web2py. The one we continuously work > on. You can find it here > https://github.com/web2py/web2py > There is a ,zip download link. > > Alternatively, if you prefer a windows binary version, you can try > download the version "for testers" here: > http://web2py.com/init/default/download > > This is not the same as "trunk" since we only make snapshots occasionally. > Yet the current one include the fix you want to test. > > Massimo > > On Saturday, 27 July 2013 01:27:13 UTC-5, James Burke wrote: >> >> Thanks for looking into this. I'm not exactly sure what 'Trunk' is. =) >> >> On Friday, July 26, 2013 8:03:32 PM UTC+12, Massimo Di Pierro wrote: >>> >>> There is a bug in SQLFORM.grid. I just pushed a fix to trunk. Please >>> check it. >>> >>> On Thursday, 25 July 2013 20:10:52 UTC-5, James Burke wrote: >>>> >>>> Hi, >>>> >>>> I just migrated my code from 2.4.6 to 2.5.1, I've encountered a >>>> problem trying to use a dict in my smartgrid >>>> >>>> with the following code: >>>> >>>> def test(): >>>> form = SQLFORM.smartgrid(db.supply, fields=dict(supply=[db.supply. >>>> id]), linked_tables=dict(supply=['job','file'])) >>>> return dict(test=form) >>>> >>>> I get this error: >>>> >>>> <type 'exceptions.UnboundLocalError'> local variable 'fld' referenced >>>> before assignment >>>> Version >>>> web2py™ Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 >>>> Python Python 2.7: C:\Program Files\myapp\web2py.exe (prefix: >>>> C:\Program Files\Terrasupply) >>>> Traceback >>>> >>>> >>>> Traceback (most recent call last): >>>> File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line >>>> 212, in restricted >>>> File "C:/Program >>>> Files/myapp/applications/init/controllers/supply.py", line 424, in >>>> <module> >>>> File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 194, >>>> in <lambda> >>>> File "/home/mdipierro/make_web2py/web2py/gluon/tools.py", line 3022, >>>> in f >>>> File "C:/Program >>>> Files/myapp/applications/init/controllers/supply.py", line 100, in test >>>> File "/home/mdipierro/make_web2py/web2py/gluon/sqlhtml.py", line >>>> 2641, in smartgrid >>>> UnboundLocalError: local variable 'fld' referenced before assignment >>>> >>>> Any ideas? >>>> >>>> Cheers, >>>> >>>> James >>>> >>> -- --- 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.