On Mon, Sep 17, 2007 at 10:36:11PM +0000, Halldór wrote: > > I'm using SO. How do I do a relationship that has a field unique for > each value in some other field. As in... I've got blog entrys and I > want the slug value to be unique for each user. But I still want to > users to be able to do 'my_first_blog' or something like that. > > Any ideas?
You can apply a unique index in Postgres (no idea about mysql or sqlite).
Use code something like this in your model:
contactCategoryUserIndex = DatabaseIndex("name", "owner", unique=True)
In my case, the name and owner columns have to make up a unique pair.
Jason
pgprtIMIytjFI.pgp
Description: PGP signature

