Thanks Anthony and Kostas.  Your solutions worked perfectly.

Alex

On Monday, August 5, 2013 6:42:49 AM UTC-7, Anthony wrote:
>
>         partyID = 
>> db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
>>
>
> Are you saying you want to redundantly store the user's auth_user.idvalue in 
> the auth_user.created_by field of the user's own record? If so, I 
> suppose you could just do an update right after the insert. After the above 
> line:
>
> db.auth_user(partyID).update_record(created_by=partyID)
>
> To avoid the redundancy, though, another option is to dynamically change 
> your is_owner lambda depending on the table being requested by the 
> smartgrid:
>
> id_field = 'created_by' if len(request.args) > 1 and '.' in request.args[-
> 2] else 'id'
> is_owner = (lambda row: row[id_field] == auth.user_id) if auth.user else 
> False
>
> That first line is not tested and may need to be tweaked (and it assumes 
> db.auth_user is the base table for the smartgrid), but something along 
> these lines should work.
>
> Anthony
>
>

-- 

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