I am trying to update some data in a form and change the value of one field
during validation; i have a custom form on the UI and when i submit the
page reloads but nothing get changed even the Hello in check_edit doesnt
show.
Any help is welcome.
@auth.requires_login()
def check_edit(form):
print "Hello"
priceperk = db(db.travel_route.id == form.vars.travel_route).select(db.travel_route.ALL)
custo = db(db.customer.id == form.vars.customer).select(db.customer.ALL)
for cust in custo:
phone = cust.phone
for pr in priceperk:
trarou=pr.price
form.vars.average_price = int(form.vars.weight)*int(trarou)
#Send SMS Based on the current status
@auth.requires_membership('Admin')
def edit_delivery():
id=request.args(0,cast=int)
form = SQLFORM(db.delivery, id)
delivery = db(db.delivery.id == id).select(db.delivery.ALL, orderby=~db.delivery.created_on)
if form.process(onvalidation=check_edit).accepted:
response.flash = T('Delivery Edited')
elif form.process(onvalidation=check_edit).errors:
print form.errors
response.flash = T('Form has errors')
else:
pass
return dict(form=form, delivery=delivery)