From cb273c14932e64334bebaadc082ff1a144e19c09 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 3 Oct 2017 05:58:14 +0200 Subject: [PATCH] Les noms des groupes sont des lettres minuscules --- users/migrations/0055_auto_20171003_0556.py | 21 +++++++++++++++++++++ users/models.py | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 users/migrations/0055_auto_20171003_0556.py diff --git a/users/migrations/0055_auto_20171003_0556.py b/users/migrations/0055_auto_20171003_0556.py new file mode 100644 index 00000000..84d901c8 --- /dev/null +++ b/users/migrations/0055_auto_20171003_0556.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2017-10-03 03:56 +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0054_auto_20170626_2219'), + ] + + operations = [ + migrations.AlterField( + model_name='listright', + name='listright', + field=models.CharField(max_length=255, unique=True, validators=[django.core.validators.RegexValidator('^[a-z]+$', message='Les groupes unix ne peuvent contenir que des lettres minuscules')]), + ), + ] diff --git a/users/models.py b/users/models.py index 652d2e1d..22364a49 100644 --- a/users/models.py +++ b/users/models.py @@ -48,6 +48,7 @@ from django.utils import timezone from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.core.validators import MinLengthValidator +from django.core.validators import RegexValidator from topologie.models import Room from cotisations.models import Cotisation, Facture, Paiement, Vente from machines.models import Domain, Interface, MachineType, Machine, Nas, MachineType, Extension, regen @@ -619,7 +620,7 @@ class School(models.Model): class ListRight(models.Model): PRETTY_NAME = "Liste des droits existants" - listright = models.CharField(max_length=255, unique=True) + listright = models.CharField(max_length=255, unique=True, validators=[RegexValidator('^[a-z]+$', message="Les groupes unix ne peuvent contenir que des lettres minuscules")]) gid = models.IntegerField(unique=True, null=True) details = models.CharField(help_text="Description", max_length=255, blank=True)