diff --git a/actu/migrations/0002_actu_rainbow.py b/actu/migrations/0002_actu_rainbow.py index 782ed5d..0d62d06 100644 --- a/actu/migrations/0002_actu_rainbow.py +++ b/actu/migrations/0002_actu_rainbow.py @@ -6,13 +6,18 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('actu', '0001_initial'), + ("actu", "0001_initial"), ] operations = [ migrations.AddField( - model_name='actu', - name='rainbow', - field=models.CharField(choices=[('y', 'Oui'), ('n', 'Non')], default='n', max_length=1, verbose_name="Actu en arc-en-ciel (ne pas mettre d'émoji, il prennent aussi la couleur et c'est moche)"), + model_name="actu", + name="rainbow", + field=models.CharField( + choices=[("y", "Oui"), ("n", "Non")], + default="n", + max_length=1, + verbose_name="Actu en arc-en-ciel (ne pas mettre d'émoji, il prennent aussi la couleur et c'est moche)", + ), ), ] diff --git a/gestion/migrations/0009_ernestouser_is_chef_mu.py b/gestion/migrations/0009_ernestouser_is_chef_mu.py index fffe718..9008e32 100644 --- a/gestion/migrations/0009_ernestouser_is_chef_mu.py +++ b/gestion/migrations/0009_ernestouser_is_chef_mu.py @@ -6,13 +6,13 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('gestion', '0008_auto_20211022_1923'), + ("gestion", "0008_auto_20211022_1923"), ] operations = [ migrations.AddField( - model_name='ernestouser', - name='is_chef_mu', - field=models.BooleanField(default=False, verbose_name='Respo musique'), + model_name="ernestouser", + name="is_chef_mu", + field=models.BooleanField(default=False, verbose_name="Respo musique"), ), ] diff --git a/gestion/mixins.py b/gestion/mixins.py index 9fc7add..3d5e1ac 100644 --- a/gestion/mixins.py +++ b/gestion/mixins.py @@ -46,6 +46,7 @@ class ChefComRequiredMixin(UserPassesTestMixin): ) return is_chef or is_chef_com + class ChefMuRequiredMixin(UserPassesTestMixin): def test_func(self): user = self.request.user @@ -74,8 +75,6 @@ class AllChefRequiredMixin(UserPassesTestMixin): and user.profile.is_chef_event ) is_chef_mu = ( - (user is not None) - and hasattr(user, "profile") - and user.profile.is_chef_mu + (user is not None) and hasattr(user, "profile") and user.profile.is_chef_mu ) return is_chef or is_chef_com or is_chef_event or is_su or is_chef_mu diff --git a/partitions/admin.py b/partitions/admin.py index a0f2312..a44fa84 100644 --- a/partitions/admin.py +++ b/partitions/admin.py @@ -1,10 +1,13 @@ from django.contrib import admin -from .models import Category, PartitionSet, SetList, Partition +from .models import Category, Partition, PartitionSet, SetList + class PartitionAdmin(admin.ModelAdmin): - list_filter = ( 'morceau', ) + list_filter = ("morceau",) + + admin.site.register(Category) admin.site.register(PartitionSet) admin.site.register(SetList) -admin.site.register(Partition,PartitionAdmin) +admin.site.register(Partition, PartitionAdmin) diff --git a/partitions/migrations/0006_auto_20220118_1525.py b/partitions/migrations/0006_auto_20220118_1525.py index 6ec4b20..2d5b34e 100644 --- a/partitions/migrations/0006_auto_20220118_1525.py +++ b/partitions/migrations/0006_auto_20220118_1525.py @@ -1,18 +1,22 @@ # Generated by Django 2.2.24 on 2022-01-18 14:25 -from django.db import migrations import django.db.models.functions.text +from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('partitions', '0005_setlist'), + ("partitions", "0005_setlist"), ] operations = [ migrations.AlterModelOptions( - name='partition', - options={'ordering': (django.db.models.functions.text.Lower('nom'),), 'verbose_name': 'Partition', 'verbose_name_plural': 'Partitions'}, + name="partition", + options={ + "ordering": (django.db.models.functions.text.Lower("nom"),), + "verbose_name": "Partition", + "verbose_name_plural": "Partitions", + }, ), ] diff --git a/partitions/migrations/0007_auto_20220118_1542.py b/partitions/migrations/0007_auto_20220118_1542.py index 76058f2..32ad604 100644 --- a/partitions/migrations/0007_auto_20220118_1542.py +++ b/partitions/migrations/0007_auto_20220118_1542.py @@ -1,18 +1,22 @@ # Generated by Django 2.2.24 on 2022-01-18 14:42 -from django.db import migrations import django.db.models.functions.text +from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('partitions', '0006_auto_20220118_1525'), + ("partitions", "0006_auto_20220118_1525"), ] operations = [ migrations.AlterModelOptions( - name='partitionset', - options={'ordering': ('category', django.db.models.functions.text.Lower('nom')), 'verbose_name': 'Morceau', 'verbose_name_plural': 'Morceaux'}, + name="partitionset", + options={ + "ordering": ("category", django.db.models.functions.text.Lower("nom")), + "verbose_name": "Morceau", + "verbose_name_plural": "Morceaux", + }, ), ] diff --git a/partitions/models.py b/partitions/models.py index 02bf0cb..8cd12fc 100644 --- a/partitions/models.py +++ b/partitions/models.py @@ -1,10 +1,10 @@ import os from django.conf import settings +from django.contrib import admin from django.db import models from django.db.models.functions import Lower from django.utils.translation import gettext_lazy as _ -from django.contrib import admin class Category(models.Model): @@ -39,7 +39,6 @@ class Partition(models.Model): ordering = (Lower("nom"),) - class PartitionSet(models.Model): nom = models.CharField(max_length=100) auteur = models.CharField(max_length=100) @@ -71,7 +70,10 @@ class PartitionSet(models.Model): class Meta: verbose_name = _("Morceau") verbose_name_plural = _("Morceaux") - ordering = ("category",Lower("nom"),) + ordering = ( + "category", + Lower("nom"), + ) from datetime import date as ddate