Thanks Malcom, I don't know why I thought it didn't work last night.
I guess I shouldn't try to figure out new stuff in the 13th working
hour of the day.

On Apr 24, 12:49 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2008-04-23 at 22:19 -0700, Tim Saylor wrote:
> > I have two columns in my database that must be, as a pair, unique
> > throughout all the rows.  Googling tells me I want a two column unique
> > index.  From the docs it looks like unique_together is what I want,
> > but that looks like it makes the two columns unique from each other
> > within the row.  Is there a way to do what I want?  Thanks!
>
> It sounds like you want 'unique_together'. That specifies tuples of
> columns that are unique as a tuple amongst all the rows in the table. So
> if
>
>         unique_together = [('first', 'second', 'third')]
>
> Then for each tuple formed from the attributes ('first', 'second',
> 'third'), there can only be one occurrence in the table.
>
> There is no default way in Django's ORM notation to say that 'first'
> must be unique amongst itself and amongst the 'second' values, etc. That
> would require adding a constraint using raw SQL.
>
> Regards,
> Malcolm
>
> --
> Borrow from a pessimist - they don't expect it 
> back.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to