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. In MySQL would be something like:
CREATE TABLE `virtual_aliases` ( id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, domainid INT(11) NOT NULL, source VARCHAR(40) NOT NULL, destination VARCHAR(80) NOT NULL, CONSTRAINT UNIQUE_EMAIL UNIQUE (domainid,source), FOREIGN KEY (domainid) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ENGINE = InnoDB; with django I only do that: class virtual_aliases(models.Model): domain = models.ForeignKey(virtual_domains) source = models.CharField(max_length=50) destination = models.CharField(max_length=60) I haven't any idea how to declare a unique constraint between 'source' and 'domain'. Any help¿¿ Thanks a lot! Marc -- 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.

