forked from DGNum/gestioCOF
We ♥ hardcoding stuff…
This commit is contained in:
parent
35b352ac1d
commit
439f49c3ba
2 changed files with 34 additions and 32 deletions
|
@ -10,7 +10,7 @@ export_patterns = [
|
||||||
url(r'^mega/avecremarques$', views.export_mega_remarksonly),
|
url(r'^mega/avecremarques$', views.export_mega_remarksonly),
|
||||||
url(r'^mega/participants$', views.export_mega_participants),
|
url(r'^mega/participants$', views.export_mega_participants),
|
||||||
url(r'^mega/orgas$', views.export_mega_orgas),
|
url(r'^mega/orgas$', views.export_mega_orgas),
|
||||||
url(r'^mega/(?P<type>.+)$', views.export_mega_bytype),
|
# url(r'^mega/(?P<type>.+)$', views.export_mega_bytype),
|
||||||
url(r'^mega$', views.export_mega),
|
url(r'^mega$', views.export_mega),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -595,13 +595,13 @@ def csv_export_mega(filename, qs):
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def export_mega_remarksonly(request):
|
def export_mega_remarksonly(request):
|
||||||
filename = 'remarques_mega_2016.csv'
|
filename = 'remarques_mega_2017.csv'
|
||||||
response = HttpResponse(content_type='text/csv')
|
response = HttpResponse(content_type='text/csv')
|
||||||
response['Content-Disposition'] = 'attachment; filename=' + filename
|
response['Content-Disposition'] = 'attachment; filename=' + filename
|
||||||
writer = unicodecsv.writer(response)
|
writer = unicodecsv.writer(response)
|
||||||
|
|
||||||
event = Event.objects.get(title="Mega 2016")
|
event = Event.objects.get(title="MEGA 2017")
|
||||||
commentfield = event.commentfields.get(name="Commentaires")
|
commentfield = event.commentfields.get(name="Commentaire")
|
||||||
for val in commentfield.values.all():
|
for val in commentfield.values.all():
|
||||||
reg = val.registration
|
reg = val.registration
|
||||||
user = reg.user
|
user = reg.user
|
||||||
|
@ -613,50 +613,52 @@ def export_mega_remarksonly(request):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
# @buro_required
|
||||||
def export_mega_bytype(request, type):
|
# def export_mega_bytype(request, type):
|
||||||
types = {"orga-actif": "Orga élève",
|
# types = {"orga-actif": "Orga élève",
|
||||||
"orga-branleur": "Orga étudiant",
|
# "orga-branleur": "Orga étudiant",
|
||||||
"conscrit-eleve": "Conscrit élève",
|
# "conscrit-eleve": "Conscrit élève",
|
||||||
"conscrit-etudiant": "Conscrit étudiant"}
|
# "conscrit-etudiant": "Conscrit étudiant"}
|
||||||
|
#
|
||||||
if type not in types:
|
# if type not in types:
|
||||||
raise Http404
|
# raise Http404
|
||||||
|
#
|
||||||
event = Event.objects.get(title="Mega 2016")
|
# event = Event.objects.get(title="MEGA 2017")
|
||||||
type_option = event.options.get(name="Type")
|
# type_option = event.options.get(name="Type")
|
||||||
participant_type = type_option.choices.get(value=types[type]).id
|
# participant_type = type_option.choices.get(value=types[type]).id
|
||||||
qs = EventRegistration.objects.filter(event=event).filter(
|
# qs = EventRegistration.objects.filter(event=event).filter(
|
||||||
options__id__exact=participant_type)
|
# options__id__exact=participant_type)
|
||||||
return csv_export_mega(type + '_mega_2016.csv', qs)
|
# return csv_export_mega(type + '_mega_2017.csv', qs)
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def export_mega_orgas(request):
|
def export_mega_orgas(request):
|
||||||
event = Event.objects.get(title="Mega 2016")
|
event = Event.objects.get(title="MEGA 2017")
|
||||||
type_option = event.options.get(name="Conscrit ou orga ?")
|
type_option = event.options.get(name="Conscrit/Orga ?")
|
||||||
participant_type = type_option.choices.get(value="Vieux").id
|
participant_type = type_option.choices.get(value="Orga").id
|
||||||
qs = EventRegistration.objects.filter(event=event).exclude(
|
qs = EventRegistration.objects.filter(event=event).filter(
|
||||||
options__id=participant_type)
|
options__id=participant_type
|
||||||
return csv_export_mega('orgas_mega_2016.csv', qs)
|
)
|
||||||
|
return csv_export_mega('orgas_mega_2017.csv', qs)
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def export_mega_participants(request):
|
def export_mega_participants(request):
|
||||||
event = Event.objects.get(title="Mega 2016")
|
event = Event.objects.get(title="MEGA 2017")
|
||||||
type_option = event.options.get(name="Conscrit ou orga ?")
|
type_option = event.options.get(name="Conscrit/Orga ?")
|
||||||
participant_type = type_option.choices.get(value="Conscrit").id
|
participant_type = type_option.choices.get(value="Conscrit").id
|
||||||
qs = EventRegistration.objects.filter(event=event).filter(
|
qs = EventRegistration.objects.filter(event=event).filter(
|
||||||
options__id=participant_type)
|
options__id=participant_type
|
||||||
return csv_export_mega('participants_mega_2016.csv', qs)
|
)
|
||||||
|
return csv_export_mega('participants_mega_2017.csv', qs)
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def export_mega(request):
|
def export_mega(request):
|
||||||
event = Event.objects.filter(title="Mega 2016")
|
event = Event.objects.filter(title="MEGA 2017")
|
||||||
qs = EventRegistration.objects.filter(event=event) \
|
qs = EventRegistration.objects.filter(event=event) \
|
||||||
.order_by("user__username")
|
.order_by("user__username")
|
||||||
return csv_export_mega('all_mega_2016.csv', qs)
|
return csv_export_mega('all_mega_2017.csv', qs)
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
|
|
Loading…
Reference in a new issue