2 fields unique

Posted by xRobot on Stack Overflow See other posts from Stack Overflow or by xRobot
Published on 2010-05-14T20:54:24Z Indexed on 2010/05/14 21:04 UTC
Read the original article Hit count: 258

Filed under:
|

I have this model:

class blog(models.Model):

    user = models.ForeignKey(User)
    mail = models.EmailField(max_length=60, null=False, blank=False)
    name = models.CharField(max_length=60, blank=True, null=True)

I want that (user,email) are unique togheter. For example:

This is allowed:

This is NOT allowed:

Is this possible in Django ?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models