web2py / py4web

Other
251 stars 126 forks source link

Bug in Form when check box "check to delete" is checked. #777

Closed ch-rigu closed 1 year ago

ch-rigu commented 1 year ago

Hi, I'm having a bug when I try to delete a record with the check box "check to delete", when is checked and then submit form, it works, the record is being deleted but not marked as "accepted" is marked as "not accepted". I need to redirect to another page after deletion of the record but I does not work. If the redirection is in the "else" condition, it works but also redirect everytime that I try to see the record..

model.py db.define_table('archivos', Field('folio_proyecto', 'string'), Field('name', 'string'), Field('archivo', 'upload', upload_path=UPLOAD_FOLDER, download_url = lambda filename: URL('download/%s' % filename)), Field('fecha', 'datetime', default=datetime.datetime.now()), )

form_file = Form(db.archivos,record=record,deletable=True, formstyle=FormStyleDefault) if form_file.accepted: redirect(URL('ver_proyecto',folio)) else: print('not accepted')

Cheers.

cdb88 commented 1 year ago

You should check form.deleted to see if a record has been deleted, it works differently than web2py.

You can see it here: https://groups.google.com/g/py4web/c/gZF4QzRCmNA/m/bm9q4R1PCwAJ

ch-rigu commented 1 year ago

Thanks for the explanation !

Regards.

De: CarlosDB @.> Fecha: lunes, 10 de abril de 2023, 08:02 Para: web2py/py4web @.> CC: ch-rigu @.>, Author @.> Asunto: Re: [web2py/py4web] Bug in Form when check box "check to delete" is checked. (Issue #777)

You should check form.deleted to see if a record has been deleted, it works differently than web2py.

You can see it here: https://groups.google.com/g/py4web/c/gZF4QzRCmNA/m/bm9q4R1PCwAJ

— Reply to this email directly, view it on GitHubhttps://github.com/web2py/py4web/issues/777#issuecomment-1501738939, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJWJRT4Q3RKZ5MMY6KOY723XAPZE7ANCNFSM6AAAAAAWKZZCNM. You are receiving this because you authored the thread.Message ID: @.***>

ch-rigu commented 1 year ago

Closing because is not a bug.