Also, in the shell, you have to do db.commit() to commit db transactions
(this is not necessary in a normal web request because the framework
handles that automatically).
See http://web2py.com/books/default/chapter/29/6#commit-and-rollback.
Anthony
On Saturday, January 14, 2012 11:52:01 AM UTC-5, DenesL wrote:
>
>
> tags has to be a list of strings, try:
>
> db.entries.insert(title='hello',tags='one,two,three'.split(','))
>
> or the equivalent:
>
> db.entries.insert(title='hello',tags=['one','two','three'])
>
>
> On Jan 14, 10:14 am, Joseph Jude <[email protected]> wrote:
> > I went into shell in a new web2py directory and tried the below.
> > Surprisingly, I get empty output. Any explanations?
> >
> > python web2py.py -S init -M
> >
> > db.define_table('entries',
> > Field('title', type='string'),
> > Field('tags', 'list:string'))
> >
> > >>> db.entries.insert(title='hello',tags='one,two,three')
> >
> > 1
> >
> > >>> t=db(db.entries.tags.contains('one')).select()
> > >>> t.as_list()
> >
> > []