You could build a custom validator around something like this: new_value.strip() # Leading/trailing white space can fool humans if not db( (db[target_table][target_field==new_value) & (db[target_table].tenant_id==tenant_id) ).isempty(): return new_value, error_message return new_value, None
Read about custom validators here: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-validators On Wednesday, June 25, 2014 2:17:06 PM UTC-4, Carlos Zenteno wrote: > > We cannot enforce uniqueness (unique=true) within a tenant in > multi-tenancy because > the database does not know about tenants. > > Has anybody found a way to enforce/design uniqueness using multi-tenancy? > > -- 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.