Other way is before and after callbacks
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks
If necessary, you can call function:
db.table1._before_insert.append( lambda f: my_function(f))
This way you do not need to manually enter the registry
thank you so much for showing simpler version, anthony.
best regards,
stifan
On Saturday, June 7, 2014 11:19:27 PM UTC+7, Anthony wrote:
Aside from the code below, somewhat simpler approaches would be to
manipulate request.post_vars *before* calling SQLFORM, or using an
onvalidation
Aside from the code below, somewhat simpler approaches would be to
manipulate request.post_vars *before* calling SQLFORM, or using an
onvalidation function (which allows you to change form.vars after
validation but before the db insert). With those approaches, you don't have
to manually do the
i think you can achieve it using form.validate :
e.g.
def booking():
form = SQLFORM(db.booking_header)
if form.validate():
db.booking_header.insert(booking_date = form.vars.booking_date,
buyer = form.vars.buyer,
4 matches
Mail list logo