This commit is contained in:
Ludovic Stephan 2017-02-08 21:08:00 -02:00
parent 217624fe08
commit 46638bd6d8
2 changed files with 19 additions and 5 deletions

View file

@ -378,12 +378,12 @@ EventFormset = formset_factory(AdminEventForm, BaseEventRegistrationFormset)
class CalendarForm(forms.ModelForm): class CalendarForm(forms.ModelForm):
subscribe_to_events = forms.BooleanField( subscribe_to_events = forms.BooleanField(
initial=True, initial=True,
label="Événements du COF.") label="Événements du COF")
subscribe_to_my_shows = forms.BooleanField( subscribe_to_my_shows = forms.BooleanField(
initial=True, initial=True,
label="Les spectacles pour lesquels j'ai obtenu une place.") label="Les spectacles pour lesquels j'ai obtenu une place")
other_shows = forms.ModelMultipleChoiceField( other_shows = forms.ModelMultipleChoiceField(
label="Spectacles supplémentaires.", label="Spectacles supplémentaires",
queryset=Spectacle.objects.filter(tirage__active=True), queryset=Spectacle.objects.filter(tirage__active=True),
widget=forms.CheckboxSelectMultiple, widget=forms.CheckboxSelectMultiple,
required=False) required=False)

View file

@ -1,4 +1,5 @@
{% extends "base_title.html" %} {% extends "base_title.html" %}
{% load bootstrap %}
{% block realcontent %} {% block realcontent %}
@ -36,8 +37,21 @@ souscrire aux événements du COF et/ou aux spectacles BdA.
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form | bootstrap }}
<input type="submit" value="Enregistrer" class="btn btn-primary" /> <p>
<button type="button" class="btn btn-default" onClick="select(true)">Tout sélectionner</button>
<button type="button" class="btn btn-default" onClick="select(false)">Tout désélectionner</button>
</p>
<input type="submit" value="Enregistrer" class="btn btn-primary center-block" />
</form> </form>
<script language="JavaScript">
function select(check) {
checkboxes = document.getElementsByName("other_shows");
for(var i=0, n=checkboxes.length;i<n;i++) {
checkboxes[i].checked = check;
}
}
</script>
{% endblock %} {% endblock %}