view

34 views
Skip to first unread message

goome

unread,
Jan 21, 2016, 5:48:34 AM1/21/16
to web2py-users
Does view truncate datas ?
I have this in controller:
[...]
  form = legacy_db(query).select()
  return dict (form = form)

and the classic view:
{{ extend 'layout.html' }}
{{=form}}


executing the funcition from the shell, i see the data correct(i mean the hole data) for example
>>> form[0]['paid_at']
'2016-01-09 18:33:37 +0100'

but in the browseri can see only:
2016-01-09 18...

this is the first time i realized this behaviour.
Is this normal?
how can i get the whole data?

Thanks

Anthony

unread,
Jan 21, 2016, 8:24:23 AM1/21/16
to web2py-users
When you display a Rows object in a view, it gets wrapped in SQLTABLE, which by default truncates values in each cell to 16 characters. To change that, you can call SQLTABLE explicitly:

{{=SQLTABLE(form, truncate=None)}}

Also, to make your code more clear, it might be better not to name a Rows object "form" (a typical generic variable name for a Rows object is simply "rows", or maybe the plural of the database table name).

Finally, it would also be helpful to make the titles of your Google Groups postings a little more explicit.

Anthony

Marcello Console

unread,
Jan 21, 2016, 11:39:12 AM1/21/16
to web...@googlegroups.com
Thank you a lot for all of your tips
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/XZOqBp__oQM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Reply all
Reply to author
Forward
0 new messages