From ea1b3c71a36533eed5d02e4c32bcf78e48cb29c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Tue, 29 Nov 2016 11:29:18 +0100 Subject: [PATCH 1/2] =?UTF-8?q?D=C3=A9corateur=20inutile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Décorateur `@buro_required` sur une fonction qui n'est pas une vue et dont le premier paramètre n'est pas la requête. --- gestioncof/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gestioncof/views.py b/gestioncof/views.py index 4f1e5009..b04b0011 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -550,7 +550,6 @@ def export_members(request): return response -@buro_required def csv_export_mega(filename, qs): response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename=' + filename From 4da7689b16196952e96f7b2d0252638464ce55e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sun, 4 Dec 2016 10:40:38 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Met=20=C3=A0=20jour=20donn=C3=A9es=20hardco?= =?UTF-8?q?d=C3=A9es...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestioncof/views.py | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/gestioncof/views.py b/gestioncof/views.py index b04b0011..3bc8c2f9 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -571,12 +571,12 @@ def csv_export_mega(filename, qs): @buro_required def export_mega_remarksonly(request): - filename = 'remarques_mega_2015.csv' + filename = 'remarques_mega_2016.csv' response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename=' + filename writer = unicodecsv.writer(response) - event = Event.objects.get(title="Mega 15") + event = Event.objects.get(title="Mega 2016") commentfield = event.commentfields.get(name="Commentaires") for val in commentfield.values.all(): reg = val.registration @@ -599,42 +599,40 @@ def export_mega_bytype(request, type): if type not in types: raise Http404 - event = Event.objects.get(title="Mega 15") + event = Event.objects.get(title="Mega 2016") 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_2015.csv', qs) + return csv_export_mega(type + '_mega_2016.csv', qs) @buro_required def export_mega_orgas(request): - 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 + event = Event.objects.get(title="Mega 2016") + type_option = event.options.get(name="Conscrit ou orga ?") + participant_type = type_option.choices.get(value="Vieux").id qs = EventRegistration.objects.filter(event=event).exclude( - options__id__in=(participant_type_a, participant_type_b)) - return csv_export_mega('orgas_mega_15.csv', qs) + options__id=participant_type) + return csv_export_mega('orgas_mega_2016.csv', qs) @buro_required def export_mega_participants(request): - 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 + event = Event.objects.get(title="Mega 2016") + type_option = event.options.get(name="Conscrit ou orga ?") + participant_type = type_option.choices.get(value="Conscrit").id qs = EventRegistration.objects.filter(event=event).filter( - options__id__in=(participant_type_a, participant_type_b)) - return csv_export_mega('participants_mega_15.csv', qs) + options__id=participant_type) + return csv_export_mega('participants_mega_2016.csv', qs) @buro_required def export_mega(request): - event = Event.objects.filter(title="Mega 15") + event = Event.objects.filter(title="Mega 2016") qs = EventRegistration.objects.filter(event=event) \ .order_by("user__username") - return csv_export_mega('all_mega_2015.csv', qs) + return csv_export_mega('all_mega_2016.csv', qs) @buro_required