On May31, 4:49pm, HansD <hans.don...@pobox.com> wrote:
> currently when having
> {{=records}}
> in your view, it prints out a table with the records, the table
> headers being the 'ugly' field names (prefixed with the table).
>
> The following patch will make use of the labels supplied on the
> db.define(...)
>
> I've not yet tested this for GAE.
>
> === modified file 'web2py/gluon/sql.py'
> ......

I don't know, perhaps Massimo intentionally designed the lowest level
db(...).select() to be rendered as an HTML table, with the raw field
names as headers.

You can use higher level SQLTABLE to output a table with customized
headers. The following code generates a table with labels as headers.

  myheaders=dict([('MyTable.%s'%f,db.MyTable[f].label) for f in
db.MyTable.fields])
  SQLTABLE(db(...).select(), headers=myheaders)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to