On Monday 17 September 2007 19:36:11 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?
I don't believe you'll be able to declare that on the columns alone. You have
two options:
- a property that will check the pair user + slug
- a composite unique index on the database
I'd go with the second choice. Just to remember, you can declare such an index
on your model, so you won't loose any "documentation" on what is being done.
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---