probably you're using sqlite that doesn't have support for unique columns
added afterwards in the model.
PS: all the "this is not preventing me" etc if you want the error to show
upon form submission, your requires is wrong. should be IS_IN_DB(db,
'auth_user.id', 'auth_user.empresa', _and=IS_NOT_IN_DB(db,
'thistable.empresa')). Or, more user-friendly......
theset = db(~db.auth_user.id.belongs(db(db.thistable.id
>0)._select(db.thistable.empresa))
requires=IS_IN_DB(theset, 'auth_user.id')
Il giorno giovedì 10 gennaio 2013 15:23:15 UTC+1, Ramos ha scritto:
>
> hello i have
>
> Field('empresa',db.auth_user,unique=True,requires=IS_IN_DB(db, '
> auth_user.id','auth_user.empresa',error_message=e_m['not_in_db'])),
>
> This is not preventing me to add another record with the same 'empresa'
> field as one already in the table
>
> What am i doing wrong?
>
> Thank you
>
--