How would you enforce a unique column constraint on a combination of
fields?

For example, say I have the model:

class Company(models.Model):
    name = models.CharField(unique=True)

class Article(models.Model):
    company = models.ForeignKey(Company)
    title = models.CharField(max_length=500)

In the Article model, I'd want to make the combination of company
+title unique. In other words, one Company could be associated with
many Articles, and one Article title could be associated with many
Comanies, but no one company should be associated with the same
Article title more than once. Is that possible?
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to