On 10 May 2015 at 04:26, A36_Marty <[email protected]> wrote:

>
>     fields = db.auth_user.first_name, db.auth_group.role
>

Make that

fields = [db.auth_user.first_name, db.auth_group.role]

fields should be a list.


query = (db.auth_user)&(db.auth_group.id == PARENT_GROUP_ID)  #get query
not supported error by the grid

You did have the variable 'query' defined two times. Is the second one
supposed to replace the first one.


And you did not show where you get PARENT_GROUP_ID from.

*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?
>
>
You can write a function to use with field.represent and use that.

Here is an example of what I have used in the past.

def get_url(url, record):
    if url:
        address = A('click here to see pdf', _target = "_blank",
                    _href = "some_prefix'%s'" % url)
    else:
        address = ''
    return address


And in the model:

                Field("url", represent = lambda x, record:
get_url(x,record)),

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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.

Reply via email to