• 1410 views
  • 0 comments
  • loading...

Update record

crud.update() returns an update form.


crud.update(table, record, next, onvalidation, onaccept, ondelete, log, message, deletable)



Attributes / Arguments

 DAL table or a tablename the method should act on

ondelete is called in place of onaccept when a record is deleted via an "update" form.

deletable determines whether the "update" form should have a delete option.


The onvalidation argument can be None or can be a function that takes the form and returns nothing. Such a function would be called and passed the form, immediately after validation (if validation passes) and before anything else happens. This function has multiple purposes: for example, to perform additional checks on the form and eventually add errors to the form, or to compute the values of some fields based on the values of other fields, or to trigger some action before a record is created/updated.

onaccept is a function to be called after the form submission is accepted and acted upon, but before redirection.

log is the log message. Log messages in CRUD see variables in the form.vars dictionary such as "%(id)s".

message is the flash message upon form acceptance.

record and record_id are the id of the record the method should act on.


Examples

loading...


Comments

loading...

Powered by
Web2py

Hosted on
www.pythonanywhere.com
(affiliated link)