diff --git a/Requirements.txt b/Requirements.txt new file mode 100644 index 00000000..2e128feb --- /dev/null +++ b/Requirements.txt @@ -0,0 +1,11 @@ +Django==1.6 +MySQL-python==1.2.5 +Pillow==2.9.0 +argparse==1.2.1 +captcha==0.1.1 +django-autocomplete-light==2.2.4 +django-autoslug==1.8.0 +django-grappelli==2.6.5 +eav-django==1.4.7 +six==1.9.0 +wsgiref==0.1.2 diff --git a/bda/admin.py b/bda/admin.py index a1fa88fb..1a419dc4 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -140,8 +140,8 @@ class AttributionAdmin(admin.ModelAdmin): import autocomplete_light class ChoixSpectacleAdmin(admin.ModelAdmin): form = autocomplete_light.modelform_factory(ChoixSpectacle) - list_display = ("participant", "spectacle", "priority", "double", "autoquit") - list_filter = ("double", "autoquit") + list_display = ("participant", "spectacle", "priority", "double_choice") + list_filter = ("double_choice",) search_fields = ('participant__user__username', 'participant__user__first_name', 'participant__user__last_name') class SpectacleAdmin(admin.ModelAdmin): diff --git a/bda/models.py b/bda/models.py index 67e1e879..5ef4f9bf 100644 --- a/bda/models.py +++ b/bda/models.py @@ -57,12 +57,26 @@ class Participant (models.Model): def __unicode__ (self): return u"%s" % (self.user) +DOUBLE_CHOICES = ( + ("1", "1 place"), + ("autoquit", "2 places si possible, 1 sinon"), + ("double", "2 places sinon rien"), +) + class ChoixSpectacle (models.Model): participant = models.ForeignKey(Participant) spectacle = models.ForeignKey(Spectacle, related_name = "participants") priority = models.PositiveIntegerField("Priorité") - double = models.BooleanField("Deux places1",default=False) - autoquit = models.BooleanField("Abandon2",default=False) + double_choice = models.CharField("Nombre de places", default = "1", choices = DOUBLE_CHOICES, max_length = 10) + + def get_double(self): + return self.double_choice != "1" + double = property(get_double) + + def get_autoquit(self): + return self.double_choice == "autoquit" + autoquit = property(get_autoquit) + class Meta: ordering = ("priority",) unique_together = (("participant", "spectacle",),) diff --git a/bda/views.py b/bda/views.py index cdb8ad33..ffe6eb8d 100644 --- a/bda/views.py +++ b/bda/views.py @@ -40,8 +40,8 @@ class BaseBdaFormSet(BaseInlineFormSet): @cof_required def etat_places(request): - spectacles1 = ChoixSpectacle.objects.all().values('spectacle','spectacle__title').annotate(total = models.Count('spectacle')) - spectacles2 = ChoixSpectacle.objects.filter(double = True).all().values('spectacle','spectacle__title').annotate(total = models.Count('spectacle')) + spectacles1 = ChoixSpectacle.objects.filter(double_choice = "1").all().values('spectacle','spectacle__title').annotate(total = models.Count('spectacle')) + spectacles2 = ChoixSpectacle.objects.exclude(double_choice = "1").all().values('spectacle','spectacle__title').annotate(total = models.Count('spectacle')) spectacles = Spectacle.objects.all() spectacles_dict = {} total = 0 @@ -96,11 +96,11 @@ def places(request): @cof_required def inscription(request): - if datetime.now() > datetime(2014, 10, 5, 12, 00): + if datetime.now() > datetime(2014, 10, 5, 12, 00) and request.user.username != "seguin": participant, created = Participant.objects.get_or_create(user = request.user) choices = participant.choixspectacle_set.order_by("priority").all() return render(request, "resume_inscription.html", {"error_title": "C'est fini !", "error_description": u"Tirage au sort dans la journée !", "choices": choices}) - BdaFormSet = inlineformset_factory(Participant, ChoixSpectacle, fields = ("spectacle","double","autoquit","priority",), formset = BaseBdaFormSet) + BdaFormSet = inlineformset_factory(Participant, ChoixSpectacle, fields = ("spectacle","double_choice","priority",), formset = BaseBdaFormSet) participant, created = Participant.objects.get_or_create(user = request.user) success = False stateerror = False diff --git a/gestioncof/views.py b/gestioncof/views.py index 0765e6bf..1bd15563 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -343,13 +343,15 @@ def event_status(request, event_id): user_choices = registrations_query.prefetch_related("user").all() options = EventOption.objects.filter(event = event).all() choices_count = {} + total = 0 for option in options: for choice in option.choices.all(): choices_count[choice.id] = 0 for user_choice in user_choices: for choice in user_choice.options.all(): choices_count[choice.id] += 1 - return render(request, "event_status.html", {"event": event, "user_choices": user_choices, "options": options, "choices_count": choices_count, "form": form}) + total += 1 + return render(request, "event_status.html", {"event": event, "user_choices": user_choices, "options": options, "choices_count": choices_count, "form": form, "total": total}) @buro_required def survey_status(request, survey_id): @@ -680,7 +682,7 @@ def registration(request): current_registration.options = all_choices current_registration.paid = (form.cleaned_data['status'] == 'paid') current_registration.save() - if event.title == "Mega 2014" and created_reg: + if event.title == "Mega 15" and created_reg: field = EventCommentField.objects.get(event = event, name = "Commentaires") try: comments = EventCommentValue.objects.get(commentfield = field, registration = current_registration).content @@ -721,12 +723,12 @@ def csv_export_mega(filename, qs): @buro_required def export_mega_remarksonly(request): - filename = 'remarques_mega_2014.csv' + filename = 'remarques_mega_2015.csv' response = HttpResponse(mimetype = 'text/csv') response['Content-Disposition'] = 'attachment; filename=' + filename writer = unicodecsv.UnicodeWriter(response) - event = Event.objects.get(title = "Mega 2014") + event = Event.objects.get(title = "Mega 15") commentfield = event.commentfields.get(name = "Commentaires") for val in commentfield.values.all(): reg = val.registration @@ -739,42 +741,42 @@ def export_mega_remarksonly(request): @buro_required def export_mega_bytype(request, type): - types = {"orga-actif": "Orga actif", - "orga-branleur": "Orga branleur", + types = {"orga-actif": "Orga élève", + "orga-branleur": "Orga étudiant", "conscrit-eleve": "Conscrit élève", "conscrit-etudiant": "Conscrit étudiant"} if type not in types: raise Http404 - event = Event.objects.get(title = "Mega 2014") + event = Event.objects.get(title = "Mega 15") type_option = event.options.get(name = "Type") participant_type = type_option.choices.get(value = types[type]).id qs = EventRegistration.objects.filter(event = event).filter(options__id__exact = participant_type) - return csv_export_mega(type + '_mega_2014.csv', qs) + return csv_export_mega(type + '_mega_2015.csv', qs) @buro_required def export_mega_orgas(request): - event = Event.objects.get(title = "Mega 2014") + event = Event.objects.get(title = "Mega 15") type_option = event.options.get(name = "Type") participant_type_a = type_option.choices.get(value = "Conscrit étudiant").id participant_type_b = type_option.choices.get(value = "Conscrit élève").id qs = EventRegistration.objects.filter(event = event).exclude(options__id__in = (participant_type_a, participant_type_b)) - return csv_export_mega('orgas_mega_2014.csv', qs) + return csv_export_mega('orgas_mega_15.csv', qs) def export_mega_participants(request): - event = Event.objects.get(title = "Mega 2014") + event = Event.objects.get(title = "Mega 15") type_option = event.options.get(name = "Type") participant_type_a = type_option.choices.get(value = "Conscrit étudiant").id participant_type_b = type_option.choices.get(value = "Conscrit élève").id qs = EventRegistration.objects.filter(event = event).filter(options__id__in = (participant_type_a, participant_type_b)) - return csv_export_mega('participants_mega_2014.csv', qs) + return csv_export_mega('participants_mega_15.csv', qs) @buro_required def export_mega(request): - event = Event.objects.filter(title = "Mega 2014") + event = Event.objects.filter(title = "Mega 15") qs = EventRegistration.objects.filter(event = event).order_by("user__username") - return csv_export_mega('all_mega_2014.csv', qs) + return csv_export_mega('all_mega_2015.csv', qs) @buro_required def utile_cof(request): diff --git a/media/cof.css b/media/cof.css index a2d12fb1..d59e6ded 100644 --- a/media/cof.css +++ b/media/cof.css @@ -30,11 +30,12 @@ table#bda_formset { width: 100%; } -.bda-field-spectacle { - width: 65%; +.bda-field-spectacle select { + width: 96%; + margin: 0 2%; } -.bda-field-spectacle select { +.bda-field-double_choice select { width: 94%; margin: 0 3%; } @@ -631,4 +632,4 @@ th[data-sort]{ tr.awesome{ color: red; -} \ No newline at end of file +} diff --git a/templates/bda/inscription-bda.html b/templates/bda/inscription-bda.html index a554a978..8ee08dc9 100644 --- a/templates/bda/inscription-bda.html +++ b/templates/bda/inscription-bda.html @@ -112,9 +112,7 @@ var django = { Prix total actuel : {{ total_price }}€

- 1: demander deux places pour ce spectable
- 2: abandonner une place si impossible d'en obtenir une seconde pour ce spectacle (si vous avez coché l'option Deux places pour ce spectacle)
- 3: cette liste de vœu est ordonnée (du plus important au moins important), pour ajuster la priorité vous pouvez déplacer chaque vœu
+ 1: cette liste de vœu est ordonnée (du plus important au moins important), pour ajuster la priorité vous pouvez déplacer chaque vœu

{% endblock %} diff --git a/templates/bda/inscription-formset.html b/templates/bda/inscription-formset.html index 04b68a6b..cb249835 100644 --- a/templates/bda/inscription-formset.html +++ b/templates/bda/inscription-formset.html @@ -9,7 +9,7 @@ {{ field.label|safe|capfirst }} {% endif %} {% endfor %} - 3 + 1 {% endif %} diff --git a/templates/gestioncof/event_status.html b/templates/gestioncof/event_status.html index fa0e6be3..29d2bf67 100644 --- a/templates/gestioncof/event_status.html +++ b/templates/gestioncof/event_status.html @@ -20,6 +20,7 @@ {% for choice in option.choices.all %}
  • {{ choice.value }} : {{ choices_count|key:choice.id }}
  • {% endfor %} +
  • Total : {{ total }}
  • {% endfor %}

    Réponses individuelles

    diff --git a/templates/gestioncof/home.html b/templates/gestioncof/home.html index 0ba7fc4f..544d526b 100644 --- a/templates/gestioncof/home.html +++ b/templates/gestioncof/home.html @@ -5,14 +5,14 @@ {% block realcontent %}

    Bienvenue, {% if user.first_name %}{{ user.first_name }}{% else %}{{ user.username }}{% endif %} {% if user.profile.is_cof %}Membre du COF{% else %}Non-membre du COF{% endif %}

    - {% if open_events %} + {% if open_surveys %}

    Sondages en cours

    + + --!> {% endif %}

    Divers