Hi all,

I am trying to create a grid with a query for auth_user table doing this:

def controller1():

    query = ((db.auth_user.id == db.auth_membership.user_id) &
             (db.auth_membership.group_id == 1))
    grid = SQLFORM.smartgrid(db.auth_user,
                             constraints=dict(auth_user=query
                                              ),
                             deletable=False,
                             editable=True,
                             create=False,
                             csv=False)
    return dict(grid=grid)

I am doing a constraint to filter only for members of group 1 in list... 
and it is working fine.

However when I try to click to any referenced table:


It shows this error:

<type 'exceptions.AttributeError'> 'Row' object has no attribute 
'first_name'
I already tried to separate queries in constraints like this:

    query1 = db.auth_membership.user_id == db.auth_user.id
    query2 = db.auth_membership.group_id == 1
    grid = SQLFORM.smartgrid(db.auth_user,
                             constraints=dict(auth_user=query1,
                                              auth_membership=query2
                                              ),
                             deletable=False,
                             editable=True,
                             create=False,
                             csv=False)

However it still return same error when clicking in one of the referenced 
tables.



Do anyone have an idea of what am I doing wrong?

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to