On Friday, September 16, 2011 12:18:30 PM UTC-4, Eric wrote:
>
> howesc: SQLFORM with the readonly=True parameter is exactly what I'm 
> looking for, except that it doesn't grab the values for the current 
> user -- all the values are set to None or not set, which is the 
> expected behavior.  If there were something like a "prepopulate" 
> argument that allowed you to pull a record where "created_by" equals 
> the current user, it would be exactly what I'm looking for.


You have to pass the record you want to display to SQLFORM (as the second 
argument). This causes SQLFORM to generate an update form for the record, 
and if you set readonly=True, it will simply be a readable view of the 
record. You can also do this via crud.read(), and the new SQLFORM.grid and 
.smartgrid (coming in the next release). The current logged in user's 
auth_user table record is in auth.user, and you can use auth.user_id to pull 
records from other tables that reference the auth_user.id field. See:

http://web2py.com/book/default/chapter/07#SQLFORM-and-insert/update/delete
http://web2py.com/book/default/chapter/07#CRUD
http://web2py.com/book/default/chapter/08#Authentication

Anthony

Reply via email to