Hi, Is there any web2py-way to change the string representation of a row? I
want my custom representation when doing 'print row' or {{=row}} in views.
I have a list of rows from different tables, and it'd be nice to take advantage
of something polymorphic like __str__ or __unicode__
controller.py
=================
def action():
rows = list(db(db.table1).select()) + list(db(db.table2).select())
return dict(rows=rw=ows)
view.html
=================
{{for row in rows}}
<div>{{=row}}</div>
{{pass}}
I know I could use db.table._format but I'd prefer not to exponse db.table to
the view.
Thanks,
Ramón
--
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.