On Wednesday, October 19, 2016 at 9:15:21 AM UTC-4, Tribo Eila wrote:
>
> Hi,
>
> supposed: 
> db.define_table('color', Field('blue'),Field('yellow'),Field('red'))
>
> COLORED_THINGS = {
>     'blue': ['sky', 'jeans', 'powerline insert mode'],
>     'yellow': ['sun', 'banana', 'phone book/monitor stand'],               
>    
>     'red': ['blood', 'tomato', 'test failure']}
>

Do you want COLORED_THINGS to be a *single record* in the "color" table? If 
so, your fields will have to be of type "list:string" (so each field can 
store a list of strings) -- for example, Field('blue', 'list:string'). In 
that case, just do:

db.color.insert(**COLORED_THINGS)

Anthony
 

>
> using db.color.insert(...). i'm trying to figure how to save in database 
> base on key dict. i tried for loops but my head starts turning.
>

-- 
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/d/optout.

Reply via email to