what is syntax for "represents" statement for this controller-styled table?
def list_users():
btn = lambda row: A("Edit", _href=URL('manage_user',
args=row.auth_user.id))
db.auth_user.edit = Field.Virtual(btn)
rows = db(db.auth_user).select()
## TRIED THIS: db.auth_user.first_name.represent = lambda v, r:
A(r.created_by.first_name, ' ', r.created_by.last_name,
_href=URL('view_user_profile', args=r.created_by))
## TRIED THIS: rows.auth_user.first_name.represent = lambda v, r:
A(r.created_by.first_name, ' ', r.created_by.last_name,
_href=URL('view_user_profile', args=r.created_by))
headers = ["ID", "Name", "Last Name", "Email", "Edit"]
fields = ['id', 'first_name', 'last_name', "email", "edit"]
table = TABLE(THEAD(TR(*[B(header) for header in headers])),
TBODY(*[TR(*[TD(row[field]) for field in fields]) \
for row in rows]))
table["_class"] = "table table-striped table-bordered table-condensed"
return dict(table=table)
thanks,
Alex Glaros
--
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.