Hello,
I want to use SQLFORM.grid in one controller like this:
def klienci():
if request.vars.a == 'adresacje':
grid=SQLFORM.grid(db.adresacje,user_signature=False)
elif request.vars.a == 'serwery' or 'serwery' in request.args:
grid=SQLFORM.grid(db.serwery,user_signature=False)
elif request.vars.a == 'klienci':
grid=SQLFORM.grid(db.klienci,user_signature=False)
return dict(grid=grid)
Form is showing, but when I click on edit (or enything else action) I
get following error:
Traceback (most recent call last):
File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
restricted
exec ccode in environment
File "/home/users/brushek/web2py/applications/staty/controllers/
default.py", line 135, in <module>
File "/home/users/brushek/web2py/gluon/globals.py", line 149, in
<lambda>
self._caller = lambda f: f()
File "/home/users/brushek/web2py/applications/staty/controllers/
default.py", line 92, in klienci
return dict(grid=grid)
UnboundLocalError: local variable 'grid' referenced before assignment
How to use grid with vars ? Do I need to make diffrent controllers/
views to use grid ?
regards
brushek