On Mon, Dec 28, 2009 at 5:15 AM, Karen Tracey <[email protected]> wrote:
> On Sun, Dec 27, 2009 at 11:08 PM, Marc Aymerich <[email protected]>wrote: > >> hi guys! >> >> I'm writing my first project with django and I have doubts in how to >> declare a constraint unique for two fields of the same table using >> models.Model. >> > > See: > > http://docs.djangoproject.com/en/1.1/ref/models/options/#unique-together > > which is a Meta option: > > http://docs.djangoproject.com/en/1.1/topics/db/models/#meta-options > > Karen > Thank you very much Karen!! :) If someone serves... class virtual_aliases(models.Model): domain = models.ForeignKey(domains) source = models.CharField(max_length=50) destination = models.CharField(max_length=60) class Meta: unique_together = ("source", "domain") > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<django-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" 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/django-users?hl=en.

