Hi,
This is a use case I did not anticipate. At the moment DbFormPage looks to see if the primary key field is specified. If it is, it updates an existing record; otherwise it creates a new record.
I'm guessing in your case you want it to always create a record, and include the primary key. You probably also want a validator on the primary key field, to warn a user if the primary key is already taken.
I think for now you should write "CreatingDbFormPage" which is mostly a copy and paste of DbFormPage, but change this:
utils.update_or_create(cls.entity, data,
protect_prm_tamp=protect_prm_tamp)
to:
record = cls.entity()
record.query.session.add(record)
tw2.sqla.utils.from_dict(record, data)
If that works for you, then we can see about adding this to tw2.sqla - either as a separate widget, or an option on DbFormPage.
Paul