instru liste for multiinstrumentiste answer in doodle
This commit is contained in:
parent
446acd1cb7
commit
fc4577c661
7 changed files with 62 additions and 18 deletions
|
@ -37,7 +37,7 @@ 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")
|
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")}),
|
||||||
}
|
}
|
||||||
|
|
23
calendrier/migrations/0006_auto_20210929_1629.py
Normal file
23
calendrier/migrations/0006_auto_20210929_1629.py
Normal file
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -3,6 +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 ErnestoUser
|
from gestion.models import ErnestoUser
|
||||||
|
|
||||||
ANSWERS = (
|
ANSWERS = (
|
||||||
|
@ -61,7 +62,8 @@ 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)
|
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(
|
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:"),
|
||||||
default="Non",
|
default="Non",
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
<div id="dont_play_main_field" {% if request.user.profile.multi_instrumentiste == "Non" %} style="display: none; "{% endif %}>
|
<div id="dont_play_main_field" {% if request.user.profile.multi_instrumentiste == "Non" %} style="display: none; "{% endif %}>
|
||||||
{% elif field.id_for_label == "id_instrument" %}
|
{% elif field.id_for_label == "id_instrument" %}
|
||||||
<div id="instru_ev_field" style="display: none; ">
|
<div id="instru_ev_field" style="display: none; ">
|
||||||
|
{% elif field.id_for_label == "id_instrument_autre" %}
|
||||||
|
<div id="instru_autre_ev_field" style="display: none; ">
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -71,4 +73,15 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('#id_instrument').on('change', function() {
|
||||||
|
|
||||||
|
if (this.value == "Autre" ) {
|
||||||
|
$('#instru_autre_ev_field').show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#instru_autre_ev_field').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -180,7 +180,11 @@
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>{% if participant.dont_play_main == 'Oui' %}
|
<td>{% if participant.dont_play_main == 'Oui' %}
|
||||||
|
{% if participant.instrument == "Autre" %}
|
||||||
|
{{participant.instrument_autre}}
|
||||||
|
{% else %}
|
||||||
{{participant.instrument}}
|
{{participant.instrument}}
|
||||||
|
{% endif %}
|
||||||
{% elif participant.participant.instru == "Autre" %}
|
{% elif participant.participant.instru == "Autre" %}
|
||||||
{{participant.participant.instru_autre}}
|
{{participant.participant.instru_autre}}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -195,6 +195,9 @@ class ViewEvent(LoginRequiredMixin, TemplateView):
|
||||||
if instru == "Autre":
|
if instru == "Autre":
|
||||||
instru = participant.participant.instru_autre
|
instru = participant.participant.instru_autre
|
||||||
if participant.dont_play_main == "Oui":
|
if participant.dont_play_main == "Oui":
|
||||||
|
if participant.instrument == "Autre":
|
||||||
|
instru = participant.instrument_autre
|
||||||
|
else:
|
||||||
instru = participant.instrument
|
instru = participant.instrument
|
||||||
|
|
||||||
sure, maybe, namesoui, namespe, namesnon = instrument_count[instru]
|
sure, maybe, namesoui, namespe, namesnon = instrument_count[instru]
|
||||||
|
|
|
@ -8,7 +8,20 @@ from django.utils.translation import gettext_lazy as _
|
||||||
import os
|
import os
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
INSTRU_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")),
|
||||||
|
]
|
||||||
class Photo(models.Model):
|
class Photo(models.Model):
|
||||||
PHOTO_PLACEMENT = (
|
PHOTO_PLACEMENT = (
|
||||||
("home_join", _("Rejoignez nous")),
|
("home_join", _("Rejoignez nous")),
|
||||||
|
@ -75,20 +88,6 @@ class ErnestoUser(models.Model):
|
||||||
help_text=_("seulement visible par les chef·fe·s"),
|
help_text=_("seulement visible par les chef·fe·s"),
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTRU_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")),
|
|
||||||
]
|
|
||||||
|
|
||||||
COLORS_CHOICES = [
|
COLORS_CHOICES = [
|
||||||
("#e4522f#ffffff", _("Orange et Blanc")),
|
("#e4522f#ffffff", _("Orange et Blanc")),
|
||||||
|
|
Loading…
Reference in a new issue