I have a model with a virtual field:
db.define_table("tt",
Field("f"),
Field("gg"),
Field.Virtual("ff", lambda r:r.tt.f)
)
And a grid:
def t():
form = SQLFORM.grid(
db.tt,
)
return dict(form=form)
Works fine.
But with the *field argument* I get an error:
def t():
form = SQLFORM.grid(
db.tt,
*fields=[**db.tt.ff]*
)
return dict(form=form)
Error ticket for "gridtest"
Ticket ID
194.118.190.134.2018-04-14.22-40-01.bc6da3b6-bd21-4dbe-8c78-f50c4a349fec
<type 'exceptions.KeyError'>Version
web2py™ Version 2.15.4-stable+timestamp.2017.09.02.04.02.22
Python Python 2.7.12: /usr/local/bin/uwsgi (prefix: /usr/local)Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Traceback (most recent call last):
File "/home/www-data/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/www-data/web2py/applications/gridtest/controllers/default.py"
<https://sx.infosms.org/admin/default/edit/gridtest/controllers/default.py>,
line 105, in <module>
File "/home/www-data/web2py/gluon/globals.py", line 414, in <lambda>
self._caller = lambda f: f()
File "/home/www-data/web2py/applications/gridtest/controllers/default.py"
<https://sx.infosms.org/admin/default/edit/gridtest/controllers/default.py>,
line 16, in t
db.tt.ff,
File "/home/www-data/web2py/gluon/sqlhtml.py", line 2886, in grid
value = row[str(field)]
File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py",
line 84, in __getitem__
raise KeyError
KeyError
What is wrong?
Regards Martin
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.