Bad unique constrain

This commit is contained in:
Valentin Samir 2015-05-18 23:38:28 +02:00
parent 0bc4e89970
commit 556aa34a3f

View File

@ -128,8 +128,11 @@ class ServicePattern(models.Model):
class Usernames(models.Model): class Usernames(models.Model):
value = models.CharField(max_length=255) value = models.CharField(max_length=255)
service_pattern = models.ForeignKey(ServicePattern, related_name="usernames") service_pattern = models.ForeignKey(ServicePattern, related_name="usernames")
class ReplaceAttributName(models.Model): class ReplaceAttributName(models.Model):
name = models.CharField(max_length=255, unique=True, help_text=u"nom d'un attributs à transmettre au service") class Meta:
unique_together = ('name', 'service_pattern')
name = models.CharField(max_length=255, help_text=u"nom d'un attributs à transmettre au service")
replace = models.CharField(max_length=255, blank=True, help_text=u"nom sous lequel l'attribut sera présenté au service. vide = inchangé") replace = models.CharField(max_length=255, blank=True, help_text=u"nom sous lequel l'attribut sera présenté au service. vide = inchangé")
service_pattern = models.ForeignKey(ServicePattern, related_name="attributs") service_pattern = models.ForeignKey(ServicePattern, related_name="attributs")