db.user_interests.insert(user_id = auth.user_id,
**dict(zip(db.user_interests.fields[2:], interests)))
Anthony
On Tuesday, September 10, 2013 4:36:03 AM UTC-4, Josyula Krishna wrote:
>
> This is my table
>
> db.define_table('user_interests',
> Field('user_id',db.auth_user),Field('Science','boolean'),Field("Arts",'boolean'),Field("BusinessEconomy",'boolean'),Field("ComputersTechnology",'boolean'))
>
> and a list which has boolean values in it each corresponding to the value
> of the field in the table
>
> interests = [True, False, True, True]
>
> Is there a way to insert this list directly into the table like
>
> db.user_interests.insert(user_id = auth.user_id, #interests go in here )
>
> How can i do it? Are there any other ways i can do it? Any help is
> appreciated.
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.