_before_insert, _after_insert, etc etc are database triggers, not validators.... if you want something that tells the user what is wrong, you need to code your own validator (or a custom onvalidation in your forms).
On Friday, August 16, 2013 8:56:13 PM UTC+2, Chun-Hung Chen wrote: > > Or if you have implementations other than my proposal, I would like to > have another viewpoint to solve the problem. Thanks. > > Chun-Hung Chen於 2013年8月17日星期六UTC+8上午2時46分05秒寫道: >> >> Hi, >> >> I have a design issue and would like to have discuss with whom is >> interested. >> >> I have 3 tables, A, B, and C, B and C both have a column reference to A. >> However, B and C is a many to many relation based on the same reference to >> A. >> I have created a mapping table D to map B and C. However, in this case, I >> could not guarantee that any B and C mapping in D would have the same >> reference to A. >> I use _before_insert to check and it works but it could not return useful >> information to the user. It is just skipped the insertion if B and C do not >> have the same reference to A. I know that I could insert some code in >> controller or so to warn or return messages to the user. I am just curious >> if it is possible to accomplish such scenario in model definition. >> >> Thanks. >> >> Regards, >> Chun-Hung >> > -- --- 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/groups/opt_out.