Répondre aux sondages à la place des fanfarons #42

Open
mdebray wants to merge 3 commits from mdebray/repondre_aux_sondages_a_la_place_des_fanfarons into master
8 changed files with 44 additions and 26 deletions
Showing only changes of commit f8b96586db - Show all commits

View file

@ -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)",
),
),
]

View file

@ -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"),
),
]

View file

@ -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

View file

@ -105,11 +105,12 @@ class FicheInstru(LoginRequiredMixin, TemplateView):
def post(self, request, *args, **kwargs):
instru = get_object_or_404(self.model, id=self.kwargs["pk"])
form = ChefEditInstrumentForm(request.POST, instance=instru)
if request.user.profile.is_chef:
if request.user.profile.is_chef or request.user.profile.is_chef_instru:
if form.is_valid():
form.save()
context = self.get_context_data()
context["form"] = form
print(instru.user)
return render(request, self.template_name, context)

View file

@ -1,9 +1,12 @@
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)

View file

@ -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",
},
),
]

View file

@ -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",
},
),
]

View file

@ -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