You can create a before_delete callback, as described here: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert--delete-and-update
If the record(s) being deleted have any references, just have the callback return True, which will cancel the delete. In that case, the .delete() call itself will return 0, so you can test for that value to determine that the delete failed. Anthony On Monday, December 4, 2017 at 10:01:38 AM UTC-5, rafi farchi wrote: > > Hi > How i can define a requiers rule so that a row in parent table can be > deleted only if it does not have any reference . if an attempt to delete > and there are rows in child tables then the delete is blocked and a message > pop up (same as in m/s access)- you can not delete it is referenced by > child tables ... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.