On Thursday, August 13, 2015 at 12:09:11 PM UTC-7, Val K wrote: > > Forget all what you've read there (joke) > If you want this rules works anywhere and independent of any insert/update > EVEN BY PROGRAM - use db.table._before_insert/update and so on (see > http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer > ) >
To be more specific <URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=_before_insert#callbacks-on-record-insert--delete-and-update> And, dang it, *I* searched for "before_", which didn't turn up anything specific; I think it did turn up the chapter level, as does "_before_insert", but I didn't think to expand it an use browser search. So I knew I was missing something and not knowing what. > It's almost SQL-level, I would say that pure SQL-level if your DB is > accessed through web2py only and you don't use db.executesql > Just keep in mind: > > - validators - UI level only > - callbacks on record insert, delete and update - any level, except > third party access and db.executesql > > > > On Thursday, August 13, 2015 at 6:17:45 AM UTC+3, JC wrote: >> >> Hello, >> I´ve the following model: >> >> db.define_table('bsc_input', >> Field('id_p_indicator', db.p_indicator, label=T( >> 'Indicator'), notnull=True), >> Field('current_month', 'integer', label=T('Month'), >> notnull=True), >> Field('current_year', 'integer', label=T('Year'), notnull >> =True), >> Field('current_value', 'float', label=T('Value'), notnull >> =True)) >> >> and I want to setup a validation so that I´m sure the combination of ' >> id_p_indicator', 'current_month' and 'current_year' are unique. >> >> How can I do it ? >> >> Thanks >> >> JC >> > -- 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.