Yes, that is possible.
def t():
db.tt.f.readable = False
form = SQLFORM.grid(db.tt)
return dict(form=form)
But now there is the next problem. I try to use the Export "CSV" button and
I get another eooror:
Ticket ID
194.118.190.134.2018-04-15.12-45-01.b4d5db05-e1e0-40b8-9233-47f2a2b37cca
<type 'exceptions.KeyError'> '"tt"."ff"'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.
15.
16.
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 100, 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 14, in t
form = SQLFORM.grid(db.tt)
File "/home/www-data/web2py/gluon/sqlhtml.py", line 2601, in grid
raise HTTP(200, oExp.export(), **response.headers)
File "/home/www-data/web2py/gluon/sqlhtml.py", line 3648, in export
self.rows.export_to_csv_file(s, represent=True)
File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py",
line 2582, in export_to_csv_file
field = fieldmap[col]
KeyError: '"tt"."ff"'
It seems that the export function does not find the virtual field.
Is there any workaround?
Martin
2018-04-15 8:43 GMT+02:00 Anthony <[email protected]>:
>
> But with the *field argument* I get an error:
>>
>> def t():
>> form = SQLFORM.grid(
>> db.tt,
>> *fields=[**db.tt.ff]*
>> )
>> return dict(form=form)
>>
>>
> What happens if you remove the "fields" argument and instead limit which
> fields display by setting their "readable" attributes to False?
>
> Anthony
>
> --
> 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.
>
--
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.