Thanks for the response Massimo!
Let's say I have 2 fields (table.user_id and table.postal_code) in a
many to many table. And this would be the controller level logic:
myduplicate = (db.table.user_id!= request.args[0]) &
(table.postal_code!= request.args[1]).select().[0]
So it's possible to have user A to have more than 1 postal code and
same postal code have more than 1 user. So what I don't want is to
duplicate an insert for the same thing (say user A with 01234 two
times). User A cannot enter the same postal codes 2 times. How do I
write this logic at the model level?
On Aug 31, 7:59 pm, mdipierro <
mdipie...@cs.depaul.edu> wrote:
> Say you have two fields a and b and you want a+b to be unique. You
> alwaysvalidateone at the time because only one can report an error.
> Therefore you you want tovalidateb so that a+b is unique:
>
> db.table.b.requires=IS_NOT_IN_DB(db
> (db.table.a==request.vars.a),'table.b')
>
> On Aug 31, 10:10 am, tititi <
briant...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I'm looking at IS_IN_DB and IS_NOT_IN_DB to filter out inserts and
> > want to know if it's possible to use 2 fields tovalidatean insert to