From f9ccd6e5407d2bf30e8451d92409a41091e974d8 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sat, 23 May 2015 19:32:02 +0200 Subject: [PATCH] CHange unique constrain --- .../migrations/0011_auto_20150523_1731.py | 18 ++++++++++++++++++ cas_server/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 cas_server/migrations/0011_auto_20150523_1731.py diff --git a/cas_server/migrations/0011_auto_20150523_1731.py b/cas_server/migrations/0011_auto_20150523_1731.py new file mode 100644 index 0000000..13ca118 --- /dev/null +++ b/cas_server/migrations/0011_auto_20150523_1731.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cas_server', '0010_auto_20150518_2139'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='replaceattributname', + unique_together=set([('name', 'replace', 'service_pattern')]), + ), + ] diff --git a/cas_server/models.py b/cas_server/models.py index 8b44b17..18693bb 100644 --- a/cas_server/models.py +++ b/cas_server/models.py @@ -132,7 +132,7 @@ class Usernames(models.Model): class ReplaceAttributName(models.Model): class Meta: - unique_together = ('name', 'service_pattern') + unique_together = ('name', 'replace', '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é") service_pattern = models.ForeignKey(ServicePattern, related_name="attributs")