New PR: dbio=True for Form([db.tbl.field, db.tbl.field2])

19 views
Skip to first unread message

laundmo

unread,
Aug 11, 2025, 9:54:01 AMAug 11
to py4web
I wanted to write forms for a subset of fields of a large table, so intuitively I tried to do

form = Form(
[
        db.table.field,
        db.table.field2,
    ],
    record=db.table(id),
    deletable=False,
)

but because Form internally sets dbio=False when `isinstance(table, list)` this doesn't work very nicely.

but the way Form is written, it seems safe to treat a list of fields as a Table and allow dbio

so i made https://github.com/web2py/py4web/pull/993 which checks whether all fields in a list are from a single table, and if they are, sets dbio to True

it also splits out the processing logic into its own method, similar to Grid, to allow custom logic before processing/validating.
Reply all
Reply to author
Forward
0 new messages