You should not do:
crud.settings.update_onaccept = myfunction()
as you are calling myfunction
right there, when you really just want to register it as a callback to be used later. Instead, use:
crud.settings.update_onaccept.tablename.append(myfunction)
Now, after the update has been accepted and applied, myfunction
will be called, and the Crud Form
object will be passed to it.
Note, if there is only one callback, you can also just do:
crud.settings.update_onaccept.tablename = myfunction
as there is no need to append to an existing list of callbacks.
Finally, if you want to use the same callback for all database tables (or are only using Crud
for a single table), you can just do:
crud.settings.update_onaccept = myfunction