https://groups.google.com/d/msg/web2py/Yl-6-oYA9C4/EkmwLNz3IegJ

Should be the first table mentioned in the query, but there is a feature 
request to make that customizable.

Anthony

On Tuesday, August 6, 2013 7:18:13 AM UTC-4, Alex Glaros wrote:
>
> Using a grid with a join, I'd like to have user edit only records they 
> created. 
>
> How do you let grid know which table you want to edit when there are 
> multiple tables in the join?
>
> Error received is: 'Row' object has no attribute 'created_by'
>
> If you can, please type the answer using example below.
>
> @auth.requires_login()
> def manage_party_addresses(): 
>     is_owner = (lambda row: row.created_by == auth.user_id) if auth.user 
> else False
>     query =(db.PartyAddressIntersection.partyID==db.Party.id) & 
> (db.PartyAddressIntersection.addressID==db.Address.id)  & 
> (db.PartyAddressIntersection.addressTypeID==db.AddressType.id)
>     grid = SQLFORM.grid(query, editable=is_owner, deletable=is_owner, 
> user_signature=True)
>     return dict(grid = grid)
>
> thanks,
>
> Alex Glaros
>

-- 

--- 
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/groups/opt_out.


Reply via email to