This comes up often. You have to enforce at the validators level.
db.define_table('t',Field('a'),Field('b'))
db.t.b.requires=IS_NOT_IN_DB(db(db.t.a==request.vars.a),db.t.b)
On Jan 18, 8:17 am, tiago almeida <[email protected]> wrote:
> Hello all,
>
> What should one do to force a specific pair of columns to be unique?
>
> Lets say I have a table where 2 of the columns are "user" and "bookmark" and
> I want the database to force the pair (user,bookmark) to be unique so that a
> specific user doesn't insert the same bookmark twice or more. Is it possible
> to do this with DAL? The only solution I see is to explicitly check for the
> existence of that pair with a select..
>
> Thanks a lot in advance,
>
> Tiago Almeida
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.