Ok, I understand, but I don't want the record to be deleted, so SET TO NULL not a solution.
Now I try what I was trying to avoid : def ondelete_func2(form): count = 0 count += db(db.table3.field2t3 == request.args(1)).count() if count > 0: pass else: session.flash = T('The record you try to delete is still referenced by other records and can\'t be deleted') redirect(URL(c='default', f='create_update', args=request.args(0))) I want to look into table3 if a id of table2 is still referenced. I know that I don't need count+= it is like that because in my own app there is not only one table3 there is 30+ tables that are referencing id of table2 and that why I would avoid using query to be informed about that. Now what I don't know how to do is to prevent the crud.update() deletion to occur in case of count > 0... Help is appreciate. Richard On Wed, Dec 12, 2012 at 12:29 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > add it because web2py does not do migration when ondelete changes. You > have to delete your database, you .tables and start again. --