You can do:

Field('user', db.auth_user, default=auth.user_id, writable=False))

Anyway, "type" and "user" are not valid field names. They work with sqlite 
but will break with postgresql and other databases.

On Monday, 7 January 2013 14:31:33 UTC-6, Dave Cenker wrote:
>
> This seems so elementary, but I can't seem to find out how to do it in the 
> book or googling the group ...
>  
> I have several users defined and when that user is logged in and is 
> creating a db record that is specific to that user, I want it to be 
> automatically assigned to him/her.
>  
> For example, given a model that defines a checking account,
>  
> db.define_table('account',
>   Field('type'),
>   Field('balance'),
>   Field('user', db.auth_user))
>  
> How can I use the crud.create forms to automatically assign the value of 
> the user field on the account model to the currently logged in user?
>  
> Thanks,
> Dave
>  
>

-- 



Reply via email to