From fc4577c66156ce122acc56675a510729c898a52f Mon Sep 17 00:00:00 2001 From: Lucie Galland Date: Thu, 30 Sep 2021 08:38:47 +0200 Subject: [PATCH] instru liste for multiinstrumentiste answer in doodle --- calendrier/forms.py | 2 +- .../migrations/0006_auto_20210929_1629.py | 23 +++++++++++++++ calendrier/models.py | 4 ++- calendrier/templates/calendrier/reponse.html | 13 +++++++++ .../templates/calendrier/view_event.html | 4 +++ calendrier/views.py | 5 +++- gestion/models.py | 29 +++++++++---------- 7 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 calendrier/migrations/0006_auto_20210929_1629.py diff --git a/calendrier/forms.py b/calendrier/forms.py index 2b67099..47c126f 100644 --- a/calendrier/forms.py +++ b/calendrier/forms.py @@ -37,7 +37,7 @@ class EventForm(forms.ModelForm): class ParticipantsForm(forms.ModelForm): class Meta: model = Participants - fields = ("reponse", "details", "dont_play_main", "instrument") + fields = ("reponse", "details", "dont_play_main", "instrument","instrument_autre") widgets = { "details": forms.Textarea(attrs={"placeholder": _("50 caractères max")}), } diff --git a/calendrier/migrations/0006_auto_20210929_1629.py b/calendrier/migrations/0006_auto_20210929_1629.py new file mode 100644 index 0000000..85cc209 --- /dev/null +++ b/calendrier/migrations/0006_auto_20210929_1629.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.24 on 2021-09-29 14:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('calendrier', '0005_auto_20210726_0949'), + ] + + operations = [ + migrations.AddField( + model_name='participants', + name='instrument_autre', + field=models.CharField(blank=True, max_length=50, null=True), + ), + migrations.AlterField( + model_name='participants', + 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), + ), + ] diff --git a/calendrier/models.py b/calendrier/models.py index 5e42fb7..c24449d 100644 --- a/calendrier/models.py +++ b/calendrier/models.py @@ -3,6 +3,7 @@ import uuid from django.db import models from django.utils.translation import gettext_lazy as _ +from gestion.models import INSTRU_CHOICES from gestion.models import ErnestoUser ANSWERS = ( @@ -61,7 +62,8 @@ class Participants(models.Model): reponse = models.CharField( _("Réponse"), max_length=20, default="non", choices=ANSWERS ) - instrument = models.CharField(max_length=50, blank=True, null=True) + instrument = models.CharField(max_length=50, blank=True, null=True, choices=INSTRU_CHOICES) + instrument_autre = models.CharField(max_length=50, blank=True, null=True) dont_play_main = models.CharField( _("Je veux jouer d'un instrument different de mon instrument principal:"), default="Non", diff --git a/calendrier/templates/calendrier/reponse.html b/calendrier/templates/calendrier/reponse.html index e222c53..9157a17 100644 --- a/calendrier/templates/calendrier/reponse.html +++ b/calendrier/templates/calendrier/reponse.html @@ -35,6 +35,8 @@