This looks like it should work, using grid, but the "edit" button doesn't
appear. only the view button.
@auth.requires_login()
def manage_user_profile():
is_owner = (lambda row: row.created_by == auth.user_id) if auth.user
else False
grid = SQLFORM.grid(db.auth_user.id == auth.user_id,
editable=is_owner,create=False, deletable=is_owner, user_signature=True),
return dict(grid=grid)
On Saturday, August 3, 2013 8:49:21 PM UTC-7, Alex Glaros wrote:
>
> I want user to see their and only their record on smartgrid that they
> created so they can edit it.
>
> I can limit who edits or deletes it with:
>
> is_owner = (lambda row: row.created_by == auth.user_id) if auth.user else
> False
> editable=is_owner, deletable=is_owner,
>
> but how do I keep other users from VIEWING the creator's record? Is there
> an "viewable=is_owner," attribute?
>
> I can restrict viewing by making the db a query instead of a db, but then
> can't edit the query.
>
> 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.