fields = [field for field in db.auth_user if field.name != 'id']
for field in fields:
    field.default = record.auth_user[field.name]

Anthony

On Friday, December 6, 2013 3:48:45 AM UTC-5, Yebach wrote:
>
> Hello
>
> I have a SQLFORM and I would like to set the default values for user 
> profile that are already in database (it is a reference of 2 tables)
>
>
> this is my current solution
> record = db((db.auth_user.organization==db.organization.id) & (
> db.auth_user.id == uid)).select().as_list()[0]
> db.auth_user.first_name.default = record["auth_user"]["first_name"]
>
>
> now  since there is quite a lot of those fields i don't want to write 
> sentance for each field. is it possible to do it with for loop or smth.
>
> thank you
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to