On Feb 21, 11:35 pm, Carlos <carlosgali...@gmail.com> wrote:
> Hi Richard,
>
> What I'm doing is as follows:
>
> Let's say I have the following model:
>
>    db.define_table('test1', Field('text1'), Field('x', readable=False))
>    db.define_table('test2', Field('text2'), Field('x', readable=False))
>
> The new factory (new DAL) requires the non readable fields (x) to be left
> out.
>
> So instead of using the following (which fails):
>
>    form = SQLFORM.factory(db.test1, db.test2)
>
> I use the following (which seems to work ok):
>
>     tables = [ db.test1, db.test2 ]
>     fields = reduce(lambda x,y: x+y, [ [ table[fieldname] for fieldname in
> table.fields ] for table in tables ])
>     fields = [ field for field in fields if field.readable ]
>     form = SQLFORM.factory(*fields)

This only works if you have all fields named differently,
i.e. if you have 'name' in table1 and 'name' in table2
then you won't be able to tell them apart.

> I hope this helps you.
>
> Also Massimo mentioned that he might support this for backwards
> compatibility, not sure.
>
>    Carlos

Reply via email to