A few novice questions while learning the SQLFORM.grid on a throw-away app.
My apologies for the basic questions
*1) How to show all users (auth_user) and related group roles
(auth_group.role) only for certain auth_groups?*
I can display *all* groups with the following code, but can't seem to
figure out how to get the WHERE clause to SQLFORM.grid.
query = db.auth_user
fields = db.auth_user.first_name, db.auth_group.role
left = db.auth_user.on(
db.auth_user.id ==
db.auth_membership.user_id).db.auth_membership.on(
db.auth_membership.group_id == db.auth_group.id)
grid = SQLFORM.grid(query = query, left=left, fields=fields)
My failed attempts to get the WHERE clause inserted:
query = (db.auth_group.id == PARENT_GROUP_ID) #No auth_user fields shown
query = (db.auth_user)&(db.auth_group.id == PARENT_GROUP_ID) #get query
not supported error by the grid
*2) How to custom-format a column based on field values?*
In the above grid example, if an auth_group.role of "Parent" is returned,
how can show something like a check mark (or any like boolean yes/no flag)
and nothing for anything other auth_group.role values?
Thanks in advance. A little nudge getting me through some the syntax
learning curve is much appreciated.
--
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.