There was a problem with this which is now fixed.
This is a very important feature if you plan to develop locally
(sqlite) and deploy on GAE.

Massimo

On Aug 10, 4:18 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Experimentally there is a new feature in trunk.
>
> Field('name','list:string')
> Field('name','list:integer')
> Field('name','list:reference other table')
>
> and new operators
>
> db.mytable.myfield.contains(4)
>
> which works for list:reference, list:integer, list:string, string and
> text types.
>
> The list: type are mapped differently on RDBS ([1,2,3]->'|1|2|3|') and
> on GAE (uses a string list propery). It is backward compatible with
> data stored using the IS_IN_DB(...,multiple=True). So here is an
> example of a program:
>
> # model
> db.define_table('product',Field('name'),format='%(name)s')
> db.define_table('purchase',Field('code'),Field('products','list:reference
> product'))
>
> # controller
> def products():
>      db.product.id.represent=lambda id: A('click
> me',_href=URL('purchases_by_product',args=id))
>      return
> dict(form=crud.create(db.product),items=db(db.product.id>0).select())
> def purchases():
>      return
> dict(form=crud.create(db.purchase),items=db(db.purchase.id>0).select())
> def purchases_by_product():
>      product_id=request.args(0)
>      return
> dict(items=db(db.purchase.products.contains(product_id)).select())
>
> Now register some products. When you try register purchases you should
> automatically get a SELECT window with product names. The list of
> items should also show a comma separated list of product names.
>
> I have not tested this on GAE. I could use some tests. Please let me
> know.
>
> Massimo

Reply via email to