Merge branch 'mdebray/linting' into 'master'

Linting

See merge request klub-dev-ens/Ernesto!20
This commit is contained in:
Lucie Galland 2022-02-21 11:13:02 +01:00
commit 99e3438ead
7 changed files with 42 additions and 25 deletions

View file

@ -6,13 +6,18 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('actu', '0001_initial'), ("actu", "0001_initial"),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='actu', model_name="actu",
name='rainbow', 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)"), 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)",
),
), ),
] ]

View file

@ -6,13 +6,13 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('gestion', '0008_auto_20211022_1923'), ("gestion", "0008_auto_20211022_1923"),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='ernestouser', model_name="ernestouser",
name='is_chef_mu', name="is_chef_mu",
field=models.BooleanField(default=False, verbose_name='Respo musique'), field=models.BooleanField(default=False, verbose_name="Respo musique"),
), ),
] ]

View file

@ -46,6 +46,7 @@ class ChefComRequiredMixin(UserPassesTestMixin):
) )
return is_chef or is_chef_com return is_chef or is_chef_com
class ChefMuRequiredMixin(UserPassesTestMixin): class ChefMuRequiredMixin(UserPassesTestMixin):
def test_func(self): def test_func(self):
user = self.request.user user = self.request.user
@ -74,8 +75,6 @@ class AllChefRequiredMixin(UserPassesTestMixin):
and user.profile.is_chef_event and user.profile.is_chef_event
) )
is_chef_mu = ( is_chef_mu = (
(user is not None) (user is not None) and hasattr(user, "profile") and user.profile.is_chef_mu
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 return is_chef or is_chef_com or is_chef_event or is_su or is_chef_mu

View file

@ -1,10 +1,13 @@
from django.contrib import admin from django.contrib import admin
from .models import Category, PartitionSet, SetList, Partition from .models import Category, Partition, PartitionSet, SetList
class PartitionAdmin(admin.ModelAdmin): class PartitionAdmin(admin.ModelAdmin):
list_filter = ( 'morceau', ) list_filter = ("morceau",)
admin.site.register(Category) admin.site.register(Category)
admin.site.register(PartitionSet) admin.site.register(PartitionSet)
admin.site.register(SetList) admin.site.register(SetList)
admin.site.register(Partition,PartitionAdmin) admin.site.register(Partition, PartitionAdmin)

View file

@ -1,18 +1,22 @@
# Generated by Django 2.2.24 on 2022-01-18 14:25 # Generated by Django 2.2.24 on 2022-01-18 14:25
from django.db import migrations
import django.db.models.functions.text import django.db.models.functions.text
from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('partitions', '0005_setlist'), ("partitions", "0005_setlist"),
] ]
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name='partition', name="partition",
options={'ordering': (django.db.models.functions.text.Lower('nom'),), 'verbose_name': 'Partition', 'verbose_name_plural': 'Partitions'}, options={
"ordering": (django.db.models.functions.text.Lower("nom"),),
"verbose_name": "Partition",
"verbose_name_plural": "Partitions",
},
), ),
] ]

View file

@ -1,18 +1,22 @@
# Generated by Django 2.2.24 on 2022-01-18 14:42 # Generated by Django 2.2.24 on 2022-01-18 14:42
from django.db import migrations
import django.db.models.functions.text import django.db.models.functions.text
from django.db import migrations
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('partitions', '0006_auto_20220118_1525'), ("partitions", "0006_auto_20220118_1525"),
] ]
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name='partitionset', name="partitionset",
options={'ordering': ('category', django.db.models.functions.text.Lower('nom')), 'verbose_name': 'Morceau', 'verbose_name_plural': 'Morceaux'}, options={
"ordering": ("category", django.db.models.functions.text.Lower("nom")),
"verbose_name": "Morceau",
"verbose_name_plural": "Morceaux",
},
), ),
] ]

View file

@ -1,10 +1,10 @@
import os import os
from django.conf import settings from django.conf import settings
from django.contrib import admin
from django.db import models from django.db import models
from django.db.models.functions import Lower from django.db.models.functions import Lower
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.contrib import admin
class Category(models.Model): class Category(models.Model):
@ -39,7 +39,6 @@ class Partition(models.Model):
ordering = (Lower("nom"),) ordering = (Lower("nom"),)
class PartitionSet(models.Model): class PartitionSet(models.Model):
nom = models.CharField(max_length=100) nom = models.CharField(max_length=100)
auteur = models.CharField(max_length=100) auteur = models.CharField(max_length=100)
@ -71,7 +70,10 @@ class PartitionSet(models.Model):
class Meta: class Meta:
verbose_name = _("Morceau") verbose_name = _("Morceau")
verbose_name_plural = _("Morceaux") verbose_name_plural = _("Morceaux")
ordering = ("category",Lower("nom"),) ordering = (
"category",
Lower("nom"),
)
from datetime import date as ddate from datetime import date as ddate