Migrations + black/isort
This commit is contained in:
parent
d217a74da5
commit
b62d6f47a4
16 changed files with 245 additions and 95 deletions
18
actu/migrations/0002_actu_rainbow.py
Normal file
18
actu/migrations/0002_actu_rainbow.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2.25 on 2022-01-06 12:09
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('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)"),
|
||||||
|
),
|
||||||
|
]
|
|
@ -7,7 +7,15 @@ class Actu(models.Model):
|
||||||
text = models.TextField(_("Info"), null=True, blank=False)
|
text = models.TextField(_("Info"), null=True, blank=False)
|
||||||
text_en = models.TextField(("Info en anglais"), null=True, blank=True)
|
text_en = models.TextField(("Info en anglais"), null=True, blank=True)
|
||||||
order = models.IntegerField(verbose_name=_("ordre"))
|
order = models.IntegerField(verbose_name=_("ordre"))
|
||||||
rainbow = models.CharField(verbose_name = _("Actu en arc-en-ciel (ne pas mettre d'émoji, il prennent aussi la couleur et c'est moche)"), max_length=1, choices = (('y', 'Oui'), ('n', 'Non')), default='n', blank = False)
|
rainbow = models.CharField(
|
||||||
|
verbose_name=_(
|
||||||
|
"Actu en arc-en-ciel (ne pas mettre d'émoji, il prennent aussi la couleur et c'est moche)"
|
||||||
|
),
|
||||||
|
max_length=1,
|
||||||
|
choices=(("y", "Oui"), ("n", "Non")),
|
||||||
|
default="n",
|
||||||
|
blank=False,
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.text
|
return self.text
|
||||||
|
|
|
@ -26,7 +26,7 @@ class EventCalendar(HTMLCalendar):
|
||||||
elif ev.calendrier == "D":
|
elif ev.calendrier == "D":
|
||||||
body.append('style="color:#770083">' + esc(ev.nom))
|
body.append('style="color:#770083">' + esc(ev.nom))
|
||||||
else:
|
else:
|
||||||
body.append('>'+esc(ev.nom))
|
body.append(">" + esc(ev.nom))
|
||||||
body.append("</a><br/>")
|
body.append("</a><br/>")
|
||||||
return self.day_cell(
|
return self.day_cell(
|
||||||
cssclass,
|
cssclass,
|
||||||
|
|
|
@ -37,7 +37,13 @@ class EventForm(forms.ModelForm):
|
||||||
class ParticipantsForm(forms.ModelForm):
|
class ParticipantsForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Participants
|
model = Participants
|
||||||
fields = ("reponse", "details", "dont_play_main", "instrument","instrument_autre")
|
fields = (
|
||||||
|
"reponse",
|
||||||
|
"details",
|
||||||
|
"dont_play_main",
|
||||||
|
"instrument",
|
||||||
|
"instrument_autre",
|
||||||
|
)
|
||||||
widgets = {
|
widgets = {
|
||||||
"details": forms.Textarea(attrs={"placeholder": _("50 caractères max")}),
|
"details": forms.Textarea(attrs={"placeholder": _("50 caractères max")}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,23 +6,41 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('calendrier', '0004_auto_20210606_1640'),
|
("calendrier", "0004_auto_20210606_1640"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='event',
|
model_name="event",
|
||||||
name='calendrier',
|
name="calendrier",
|
||||||
field=models.CharField(choices=[('F', 'Visible seulement par les fanfarons'), ('T', 'Afficher dans le calendrier pour tous'), ('H', 'Hall of fame'), ('C', 'Visible seulement par les cheff·e·s'), ('D', "Visible seulement par les cheff·e·s et sur l'agenda public")], default='F', max_length=1),
|
field=models.CharField(
|
||||||
|
choices=[
|
||||||
|
("F", "Visible seulement par les fanfarons"),
|
||||||
|
("T", "Afficher dans le calendrier pour tous"),
|
||||||
|
("H", "Hall of fame"),
|
||||||
|
("C", "Visible seulement par les cheff·e·s"),
|
||||||
|
("D", "Visible seulement par les cheff·e·s et sur l'agenda public"),
|
||||||
|
],
|
||||||
|
default="F",
|
||||||
|
max_length=1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='event',
|
model_name="event",
|
||||||
name='desc_users',
|
name="desc_users",
|
||||||
field=models.TextField(blank=True, null=True, verbose_name='Infos (visible seulement des fanfaron·ne·s)'),
|
field=models.TextField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
verbose_name="Infos (visible seulement des fanfaron·ne·s)",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='event',
|
model_name="event",
|
||||||
name='desc_users_en',
|
name="desc_users_en",
|
||||||
field=models.TextField(blank=True, null=True, verbose_name='Infos en anglais (visible seulement des fanfaron·ne·s'),
|
field=models.TextField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
verbose_name="Infos en anglais (visible seulement des fanfaron·ne·s",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,18 +6,36 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('calendrier', '0005_auto_20210726_0949'),
|
("calendrier", "0005_auto_20210726_0949"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='participants',
|
model_name="participants",
|
||||||
name='instrument_autre',
|
name="instrument_autre",
|
||||||
field=models.CharField(blank=True, max_length=50, null=True),
|
field=models.CharField(blank=True, max_length=50, null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='participants',
|
model_name="participants",
|
||||||
name='instrument',
|
name="instrument",
|
||||||
field=models.CharField(blank=True, choices=[('Clarinette', 'Clarinette'), ('Euphonium', 'Euphonium'), ('Percussion', 'Percussion'), ('Piccolo', 'Piccolo'), ('Saxophone Alto', 'Saxophone Alto'), ('Saxophone Ténor', 'Saxophone Ténor'), ('Saxophone Baryton', 'Saxophone Baryton'), ('Souba', 'Souba'), ('Trombone', 'Trombone'), ('Trompette', 'Trompette'), ('Autre', 'Autre'), ('ne sais pas', 'Je ne sais pas encore')], max_length=50, null=True),
|
field=models.CharField(
|
||||||
|
blank=True,
|
||||||
|
choices=[
|
||||||
|
("Clarinette", "Clarinette"),
|
||||||
|
("Euphonium", "Euphonium"),
|
||||||
|
("Percussion", "Percussion"),
|
||||||
|
("Piccolo", "Piccolo"),
|
||||||
|
("Saxophone Alto", "Saxophone Alto"),
|
||||||
|
("Saxophone Ténor", "Saxophone Ténor"),
|
||||||
|
("Saxophone Baryton", "Saxophone Baryton"),
|
||||||
|
("Souba", "Souba"),
|
||||||
|
("Trombone", "Trombone"),
|
||||||
|
("Trompette", "Trompette"),
|
||||||
|
("Autre", "Autre"),
|
||||||
|
("ne sais pas", "Je ne sais pas encore"),
|
||||||
|
],
|
||||||
|
max_length=50,
|
||||||
|
null=True,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -3,8 +3,7 @@ import uuid
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from gestion.models import INSTRU_CHOICES
|
from gestion.models import INSTRU_CHOICES, ErnestoUser
|
||||||
from gestion.models import ErnestoUser
|
|
||||||
|
|
||||||
ANSWERS = (
|
ANSWERS = (
|
||||||
("oui", _("Oui")),
|
("oui", _("Oui")),
|
||||||
|
@ -62,7 +61,9 @@ class Participants(models.Model):
|
||||||
reponse = models.CharField(
|
reponse = models.CharField(
|
||||||
_("Réponse"), max_length=20, default="non", choices=ANSWERS
|
_("Réponse"), max_length=20, default="non", choices=ANSWERS
|
||||||
)
|
)
|
||||||
instrument = models.CharField(max_length=50, blank=True, null=True, choices=INSTRU_CHOICES)
|
instrument = models.CharField(
|
||||||
|
max_length=50, blank=True, null=True, choices=INSTRU_CHOICES
|
||||||
|
)
|
||||||
instrument_autre = models.CharField(max_length=50, blank=True, null=True)
|
instrument_autre = models.CharField(max_length=50, blank=True, null=True)
|
||||||
dont_play_main = models.CharField(
|
dont_play_main = models.CharField(
|
||||||
_("Je veux jouer d'un instrument different de mon instrument principal:"),
|
_("Je veux jouer d'un instrument different de mon instrument principal:"),
|
||||||
|
|
|
@ -16,7 +16,7 @@ from calendrier.calend import EventCalendar
|
||||||
from calendrier.forms import (ChangeDoodleName, EventForm, ModifEventForm,
|
from calendrier.forms import (ChangeDoodleName, EventForm, ModifEventForm,
|
||||||
ParticipantsForm)
|
ParticipantsForm)
|
||||||
from calendrier.models import Event, Participants
|
from calendrier.models import Event, Participants
|
||||||
from gestion.mixins import ChefRequiredMixin, ChefEventRequiredMixin
|
from gestion.mixins import ChefEventRequiredMixin, ChefRequiredMixin
|
||||||
from gestion.models import Photo
|
from gestion.models import Photo
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,9 +76,13 @@ class Calendar(LoginRequiredMixin, TemplateView):
|
||||||
lMonth = self.pMonth
|
lMonth = self.pMonth
|
||||||
lCalendarFromMonth = datetime(lYear, lMonth, 1)
|
lCalendarFromMonth = datetime(lYear, lMonth, 1)
|
||||||
lCalendarToMonth = datetime(lYear, lMonth, monthrange(lYear, lMonth)[1])
|
lCalendarToMonth = datetime(lYear, lMonth, monthrange(lYear, lMonth)[1])
|
||||||
lEvents = Event.objects.filter(
|
lEvents = (
|
||||||
|
Event.objects.filter(
|
||||||
date__gte=lCalendarFromMonth, date__lte=lCalendarToMonth
|
date__gte=lCalendarFromMonth, date__lte=lCalendarToMonth
|
||||||
).exclude(calendrier__iexact="C").exclude(calendrier__iexact="D")
|
)
|
||||||
|
.exclude(calendrier__iexact="C")
|
||||||
|
.exclude(calendrier__iexact="D")
|
||||||
|
)
|
||||||
lEvents_chef = Event.objects.filter(
|
lEvents_chef = Event.objects.filter(
|
||||||
date__gte=lCalendarFromMonth, date__lte=lCalendarToMonth
|
date__gte=lCalendarFromMonth, date__lte=lCalendarToMonth
|
||||||
)
|
)
|
||||||
|
@ -170,7 +174,6 @@ class Calendar(LoginRequiredMixin, TemplateView):
|
||||||
|
|
||||||
|
|
||||||
class Home(Calendar):
|
class Home(Calendar):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pYear(self):
|
def pYear(self):
|
||||||
lToday = datetime.now()
|
lToday = datetime.now()
|
||||||
|
@ -234,25 +237,52 @@ class ViewEvent(LoginRequiredMixin, TemplateView):
|
||||||
namesnon += [participant.participant.get_doodlename()]
|
namesnon += [participant.participant.get_doodlename()]
|
||||||
instrument_count[instru] = (sure, maybe, namesoui, namespe, namesnon)
|
instrument_count[instru] = (sure, maybe, namesoui, namespe, namesnon)
|
||||||
instrument_count_l = []
|
instrument_count_l = []
|
||||||
instru_order = ["Clarinette","Piccolo","Flute","Glockenspiel","Saxophone Alto","Trompette","Trombone","Cor","Saxophone Ténor","Saxophone Baryton","Clarinette Basse","Euphonium","Souba","Percussion"]
|
instru_order = [
|
||||||
|
"Clarinette",
|
||||||
|
"Piccolo",
|
||||||
|
"Flute",
|
||||||
|
"Glockenspiel",
|
||||||
|
"Saxophone Alto",
|
||||||
|
"Trompette",
|
||||||
|
"Trombone",
|
||||||
|
"Cor",
|
||||||
|
"Saxophone Ténor",
|
||||||
|
"Saxophone Baryton",
|
||||||
|
"Clarinette Basse",
|
||||||
|
"Euphonium",
|
||||||
|
"Souba",
|
||||||
|
"Percussion",
|
||||||
|
]
|
||||||
for instrument in instru_order:
|
for instrument in instru_order:
|
||||||
if instrument in instrument_count.keys():
|
if instrument in instrument_count.keys():
|
||||||
(sure,maybe,namesoui,namespe,namesnon) =instrument_count[instrument]
|
(sure, maybe, namesoui, namespe, namesnon) = instrument_count[
|
||||||
instrument_count_l.append(( instrument, sure,
|
instrument
|
||||||
|
]
|
||||||
|
instrument_count_l.append(
|
||||||
|
(
|
||||||
|
instrument,
|
||||||
|
sure,
|
||||||
maybe,
|
maybe,
|
||||||
namesoui,
|
namesoui,
|
||||||
namespe,
|
namespe,
|
||||||
namesnon,
|
namesnon,
|
||||||
))
|
)
|
||||||
|
)
|
||||||
for instrument in sorted(instrument_count.keys()):
|
for instrument in sorted(instrument_count.keys()):
|
||||||
if instrument not in instru_order:
|
if instrument not in instru_order:
|
||||||
(sure,maybe,namesoui,namespe,namesnon) =instrument_count[instrument]
|
(sure, maybe, namesoui, namespe, namesnon) = instrument_count[
|
||||||
instrument_count_l.append(( instrument, sure,
|
instrument
|
||||||
|
]
|
||||||
|
instrument_count_l.append(
|
||||||
|
(
|
||||||
|
instrument,
|
||||||
|
sure,
|
||||||
maybe,
|
maybe,
|
||||||
namesoui,
|
namesoui,
|
||||||
namespe,
|
namespe,
|
||||||
namesnon,
|
namesnon,
|
||||||
))
|
)
|
||||||
|
)
|
||||||
|
|
||||||
context["event"] = event
|
context["event"] = event
|
||||||
context["instrument_count"] = instrument_count_l
|
context["instrument_count"] = instrument_count_l
|
||||||
|
@ -337,7 +367,9 @@ class ReponseEvent(LoginRequiredMixin, TemplateView):
|
||||||
context["form"] = self.form_class()
|
context["form"] = self.form_class()
|
||||||
context["ev"] = get_object_or_404(Event, id=self.kwargs["id"])
|
context["ev"] = get_object_or_404(Event, id=self.kwargs["id"])
|
||||||
context["id"] = self.kwargs["id"]
|
context["id"] = self.kwargs["id"]
|
||||||
context["chef_only"] = (context["ev"].calendrier == "C")|(context["ev"].calendrier == "D")
|
context["chef_only"] = (context["ev"].calendrier == "C") | (
|
||||||
|
context["ev"].calendrier == "D"
|
||||||
|
)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
# Generated by Django 2.2.17 on 2021-06-08 10:29
|
# Generated by Django 2.2.17 on 2021-06-08 10:29
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
import gestion.models
|
import gestion.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('gestion', '0005_auto_20210427_1834'),
|
("gestion", "0005_auto_20210427_1834"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='photo',
|
model_name="photo",
|
||||||
name='image',
|
name="image",
|
||||||
field=models.ImageField(default=None, upload_to='trombonoscope/deco', validators=[gestion.models.Photo.validate_image]),
|
field=models.ImageField(
|
||||||
|
default=None,
|
||||||
|
upload_to="trombonoscope/deco",
|
||||||
|
validators=[gestion.models.Photo.validate_image],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,13 +6,15 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('gestion', '0006_auto_20210608_1029'),
|
("gestion", "0006_auto_20210608_1029"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ernestouser',
|
model_name="ernestouser",
|
||||||
name='is_chef_event',
|
name="is_chef_event",
|
||||||
field=models.BooleanField(default=False, verbose_name='Respo événement Fanfare'),
|
field=models.BooleanField(
|
||||||
|
default=False, verbose_name="Respo événement Fanfare"
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,23 +6,23 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('gestion', '0007_ernestouser_is_chef_event'),
|
("gestion", "0007_ernestouser_is_chef_event"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ernestouser',
|
model_name="ernestouser",
|
||||||
name='is_chef_com',
|
name="is_chef_com",
|
||||||
field=models.BooleanField(default=False, verbose_name='Respo com'),
|
field=models.BooleanField(default=False, verbose_name="Respo com"),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='ernestouser',
|
model_name="ernestouser",
|
||||||
name='is_chef_instru',
|
name="is_chef_instru",
|
||||||
field=models.BooleanField(default=False, verbose_name='Respo instruments'),
|
field=models.BooleanField(default=False, verbose_name="Respo instruments"),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='ernestouser',
|
model_name="ernestouser",
|
||||||
name='is_chef_event',
|
name="is_chef_event",
|
||||||
field=models.BooleanField(default=False, verbose_name='Respo événements'),
|
field=models.BooleanField(default=False, verbose_name="Respo événements"),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,32 +6,60 @@ class ChefRequiredMixin(UserPassesTestMixin):
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
return (user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
return (user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
||||||
|
|
||||||
|
|
||||||
class ChefEventRequiredMixin(UserPassesTestMixin):
|
class ChefEventRequiredMixin(UserPassesTestMixin):
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
is_chef = (user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
is_chef = (
|
||||||
is_chef_event = (user is not None) and hasattr(user, "profile") and user.profile.is_chef_event
|
(user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
||||||
|
)
|
||||||
|
is_chef_event = (
|
||||||
|
(user is not None)
|
||||||
|
and hasattr(user, "profile")
|
||||||
|
and user.profile.is_chef_event
|
||||||
|
)
|
||||||
return is_chef or is_chef_event
|
return is_chef or is_chef_event
|
||||||
|
|
||||||
|
|
||||||
class ChefInstruRequiredMixin(UserPassesTestMixin):
|
class ChefInstruRequiredMixin(UserPassesTestMixin):
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
is_chef = (user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
is_chef = (
|
||||||
is_chef_instru = (user is not None) and hasattr(user, "profile") and user.profile.is_chef_instru
|
(user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
||||||
|
)
|
||||||
|
is_chef_instru = (
|
||||||
|
(user is not None)
|
||||||
|
and hasattr(user, "profile")
|
||||||
|
and user.profile.is_chef_instru
|
||||||
|
)
|
||||||
return is_chef or is_chef_instru
|
return is_chef or is_chef_instru
|
||||||
|
|
||||||
|
|
||||||
class ChefComRequiredMixin(UserPassesTestMixin):
|
class ChefComRequiredMixin(UserPassesTestMixin):
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
is_chef = (user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
is_chef = (
|
||||||
is_chef_com = (user is not None) and hasattr(user, "profile") and user.profile.is_chef_com
|
(user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
||||||
|
)
|
||||||
|
is_chef_com = (
|
||||||
|
(user is not None) and hasattr(user, "profile") and user.profile.is_chef_com
|
||||||
|
)
|
||||||
return is_chef or is_chef_com
|
return is_chef or is_chef_com
|
||||||
|
|
||||||
|
|
||||||
class AllChefRequiredMixin(UserPassesTestMixin):
|
class AllChefRequiredMixin(UserPassesTestMixin):
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
is_chef = (user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
is_chef = (
|
||||||
|
(user is not None) and hasattr(user, "profile") and user.profile.is_chef
|
||||||
|
)
|
||||||
is_su = (user is not None) and user.is_superuser
|
is_su = (user is not None) and user.is_superuser
|
||||||
is_chef_com = (user is not None) and hasattr(user, "profile") and user.profile.is_chef_com
|
is_chef_com = (
|
||||||
is_chef_event = (user is not None) and hasattr(user, "profile") and user.profile.is_chef_event
|
(user is not None) and hasattr(user, "profile") and user.profile.is_chef_com
|
||||||
|
)
|
||||||
|
is_chef_event = (
|
||||||
|
(user is not None)
|
||||||
|
and hasattr(user, "profile")
|
||||||
|
and user.profile.is_chef_event
|
||||||
|
)
|
||||||
return is_chef or is_chef_com or is_chef_event or is_su
|
return is_chef or is_chef_com or is_chef_event or is_su
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from colorful.fields import RGBColorField
|
from colorful.fields import RGBColorField
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
import os
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
INSTRU_CHOICES = [
|
INSTRU_CHOICES = [
|
||||||
("Clarinette", _("Clarinette")),
|
("Clarinette", _("Clarinette")),
|
||||||
|
@ -22,6 +23,8 @@ INSTRU_CHOICES = [
|
||||||
("Autre", _("Autre")),
|
("Autre", _("Autre")),
|
||||||
("ne sais pas", _("Je ne sais pas encore")),
|
("ne sais pas", _("Je ne sais pas encore")),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Photo(models.Model):
|
class Photo(models.Model):
|
||||||
PHOTO_PLACEMENT = (
|
PHOTO_PLACEMENT = (
|
||||||
("home_join", _("Rejoignez nous")),
|
("home_join", _("Rejoignez nous")),
|
||||||
|
@ -91,7 +94,6 @@ class ErnestoUser(models.Model):
|
||||||
help_text=_("seulement visible par les chef·fe·s"),
|
help_text=_("seulement visible par les chef·fe·s"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
COLORS_CHOICES = [
|
COLORS_CHOICES = [
|
||||||
("#e4522f#ffffff", _("Orange et Blanc")),
|
("#e4522f#ffffff", _("Orange et Blanc")),
|
||||||
("#ffffff#000000", _("Blanc et Noir")),
|
("#ffffff#000000", _("Blanc et Noir")),
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
|
@ -11,12 +12,12 @@ from django.urls import reverse_lazy
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import (CreateView, DeleteView, ListView,
|
from django.views.generic import (CreateView, DeleteView, ListView,
|
||||||
TemplateView, UpdateView)
|
TemplateView, UpdateView)
|
||||||
import os
|
|
||||||
|
|
||||||
from calendrier.forms import ChangeDoodleName
|
from calendrier.forms import ChangeDoodleName
|
||||||
from gestion.forms import (ChangeFormUser, ChangeMembreForm,
|
from gestion.forms import (ChangeFormUser, ChangeMembreForm,
|
||||||
InscriptionMembreForm, RegistrationFormUser)
|
InscriptionMembreForm, RegistrationFormUser)
|
||||||
from gestion.mixins import ChefRequiredMixin, AllChefRequiredMixin, ChefComRequiredMixin
|
from gestion.mixins import (AllChefRequiredMixin, ChefComRequiredMixin,
|
||||||
|
ChefRequiredMixin)
|
||||||
from gestion.models import ErnestoUser, Photo, VideoGallery
|
from gestion.models import ErnestoUser, Photo, VideoGallery
|
||||||
from partitions.models import Category
|
from partitions.models import Category
|
||||||
|
|
||||||
|
@ -79,6 +80,7 @@ class Profil(LoginRequiredMixin, TemplateView):
|
||||||
class Chef(AllChefRequiredMixin, TemplateView):
|
class Chef(AllChefRequiredMixin, TemplateView):
|
||||||
template_name = "gestion/chef.html"
|
template_name = "gestion/chef.html"
|
||||||
|
|
||||||
|
|
||||||
class YearBook2021(TemplateView):
|
class YearBook2021(TemplateView):
|
||||||
template_name = "gestion/yearbook2021.html"
|
template_name = "gestion/yearbook2021.html"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe
|
||||||
from django.views.generic import (CreateView, DeleteView, TemplateView,
|
from django.views.generic import (CreateView, DeleteView, TemplateView,
|
||||||
UpdateView)
|
UpdateView)
|
||||||
|
|
||||||
from gestion.mixins import ChefRequiredMixin, ChefInstruRequiredMixin
|
from gestion.mixins import ChefInstruRequiredMixin, ChefRequiredMixin
|
||||||
from gestion.models import Photo
|
from gestion.models import Photo
|
||||||
from instruments.forms import ChefEditInstrumentForm, ChefReparationForm
|
from instruments.forms import ChefEditInstrumentForm, ChefReparationForm
|
||||||
from instruments.models import Instrument, Reparation
|
from instruments.models import Instrument, Reparation
|
||||||
|
@ -28,7 +28,17 @@ class ListeInstru(LoginRequiredMixin, TemplateView):
|
||||||
|
|
||||||
class CreateInstru(ChefInstruRequiredMixin, CreateView):
|
class CreateInstru(ChefInstruRequiredMixin, CreateView):
|
||||||
model = Instrument
|
model = Instrument
|
||||||
fields = ["owner","user", "etat", "type", "marque", "model", "serial", "annee", "prix"]
|
fields = [
|
||||||
|
"owner",
|
||||||
|
"user",
|
||||||
|
"etat",
|
||||||
|
"type",
|
||||||
|
"marque",
|
||||||
|
"model",
|
||||||
|
"serial",
|
||||||
|
"annee",
|
||||||
|
"prix",
|
||||||
|
]
|
||||||
template_name = "instruments/create_instru.html"
|
template_name = "instruments/create_instru.html"
|
||||||
success_url = reverse_lazy("instruments:liste")
|
success_url = reverse_lazy("instruments:liste")
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.urls import reverse_lazy
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
||||||
|
|
||||||
from gestion.mixins import ChefRequiredMixin, ChefEventRequiredMixin
|
from gestion.mixins import ChefEventRequiredMixin, ChefRequiredMixin
|
||||||
from pads.models import Pad
|
from pads.models import Pad
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue