From d8dba17731969bdda7b7f9bea4d0cf2fcfa67867 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sun, 30 May 2021 00:40:32 +0200 Subject: [PATCH] =?UTF-8?q?On=20d=C3=A9place=20les=20permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0026_auto_20210529_2246.py | 24 +++++++++++++++++++ elections/models.py | 6 ++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 elections/migrations/0026_auto_20210529_2246.py diff --git a/elections/migrations/0026_auto_20210529_2246.py b/elections/migrations/0026_auto_20210529_2246.py new file mode 100644 index 0000000..91230f1 --- /dev/null +++ b/elections/migrations/0026_auto_20210529_2246.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.3 on 2021-05-29 20:46 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("elections", "0025_alter_option_abbreviation"), + ] + + operations = [ + migrations.AlterModelOptions( + name="election", + options={ + "ordering": ["-start_date", "-end_date"], + "permissions": [("is_admin", "Peut administrer des élections")], + }, + ), + migrations.AlterModelOptions( + name="user", + options={"ordering": ["username"]}, + ), + ] diff --git a/elections/models.py b/elections/models.py index c7c61c8..07d1f17 100644 --- a/elections/models.py +++ b/elections/models.py @@ -70,6 +70,9 @@ class Election(models.Model): archived = models.BooleanField(_("archivée"), default=False) class Meta: + permissions = [ + ("is_admin", _("Peut administrer des élections")), + ] ordering = ["-start_date", "-end_date"] @@ -233,7 +236,4 @@ class User(AbstractUser): return CONNECTION_METHODS.get(method, _("identifiants spécifiques")) class Meta: - permissions = [ - ("is_admin", _("Peut administrer des élections")), - ] ordering = ["username"]