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: 283
django
|django-models
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:
1, hello@hello.com, myblog
2, hello@hello.com, secondblog
This is NOT allowed:
1, hello@hello.com, myblog
1, hello@hello.com, secondblog
Is this possible in Django ?
© Stack Overflow or respective owner