It does not work because this db.t.f1 is a field (a column) not a
value (true or false).
I guess what you want is make the second field readable or writable
depending on which record you are looking at. For example it makes no
sense if you are inserting a new record, should the second field be
editable or not?
That requires that you do it in controllers for example:
def edit_t():
record = db.t(request.args(0))
if record: db.t.f2.writable = record.f1
else db.t2.writable = true
form = SQLFORM(db.t, record).process()
return dict(form=form)
On Jan 20, 5:12 pm, Martin Weissenboeck <[email protected]> wrote:
> Hi,
>
> I want to have a model like
>
> db.define_table("t",
> Field('f1', 'boolean'),
> Field('f2', 'boolean', writable = db.t.f1),
> )
>
> Of course, this does not work, but how could it be written?
>
> Regards, Martin