From e9bbb35e66568df267f798b88a833a94c551ef6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Thu, 4 Aug 2016 17:38:58 +0200 Subject: [PATCH] Ajout d'un index sur Account.trigramme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En fait inutile car déjà créé du fait de la contrainte d'unicité --- kfet/migrations/0008_auto_20160804_1736.py | 20 ++++++++++++++++++++ kfet/models.py | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 kfet/migrations/0008_auto_20160804_1736.py diff --git a/kfet/migrations/0008_auto_20160804_1736.py b/kfet/migrations/0008_auto_20160804_1736.py new file mode 100644 index 00000000..1abbb76a --- /dev/null +++ b/kfet/migrations/0008_auto_20160804_1736.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.core.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('kfet', '0007_auto_20160804_0641'), + ] + + operations = [ + migrations.AlterField( + model_name='account', + name='trigramme', + field=models.CharField(unique=True, validators=[django.core.validators.RegexValidator(regex='^[^a-z]{3}$')], db_index=True, max_length=3), + ), + ] diff --git a/kfet/models.py b/kfet/models.py index af5ac686..ad51383a 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -21,7 +21,8 @@ class Account(models.Model): trigramme = models.CharField( unique = True, max_length = 3, - validators = [RegexValidator(regex='^[^a-z]{3}$')]) + validators = [RegexValidator(regex='^[^a-z]{3}$')], + db_index = True) balance = models.DecimalField( max_digits = 6, decimal_places = 2, default = 0)