Unique set of fields in a model
Hello,
I'm looking for a way to define uniquness for a set of more than one
field in a model.
For example:
class Item(models.Model):
order = models.ForeignKey(Order)
number = models.IntegerField()
...
I want the number to be unique per order, and not unique throughout
the table.
How do I define that the combination <order, number> should be unique?
Thanks,
Ilya
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home