I see... So you have in your form only the readable fields... I suppose that
when the form is submit your controller insert manually the values of the
omitted fields. Because in case a readable=False field that is notnull
(requiered=True...) it has to get value.

Richard

On Mon, Feb 21, 2011 at 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)
>
> I hope this helps you.
>
> Also Massimo mentioned that he might support this for backwards
> compatibility, not sure.
>
>    Carlos
>
>

Reply via email to