From 515a7ce28ece2b711f736d660b35fb5bb24675cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Sun, 7 Aug 2016 18:41:09 +0200 Subject: [PATCH] =?UTF-8?q?Mod=C3=A8le=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ajout de l'unicité du nom d'un paramètre Ce qui a pour conséquence de rajouter un index sur le nom, ce qui est bien --- kfet/migrations/0013_auto_20160807_1840.py | 19 +++++++++++++++++++ kfet/models.py | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 kfet/migrations/0013_auto_20160807_1840.py diff --git a/kfet/migrations/0013_auto_20160807_1840.py b/kfet/migrations/0013_auto_20160807_1840.py new file mode 100644 index 00000000..d7ce2c75 --- /dev/null +++ b/kfet/migrations/0013_auto_20160807_1840.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('kfet', '0012_settings'), + ] + + operations = [ + migrations.AlterField( + model_name='settings', + name='name', + field=models.CharField(unique=True, max_length=45), + ), + ] diff --git a/kfet/models.py b/kfet/models.py index 57a85320..31eac33e 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -418,7 +418,9 @@ class GlobalPermissions(models.Model): ) class Settings(models.Model): - name = models.CharField(max_length = 45) + name = models.CharField( + max_length = 45, + unique = True) value_decimal = models.DecimalField( max_digits = 6, decimal_places = 2, blank = True, null = True, default = None)