Skip to content
Snippets Groups Projects
Commit 15e28a65 authored by Thomas Bidot-naude's avatar Thomas Bidot-naude
Browse files

Rectification Exportation excel sorties

parent f7a39a7c
No related branches found
No related tags found
1 merge request!41Rectification Exportation excel sorties
......@@ -63,7 +63,6 @@ class RegistrationsOpenFilter(admin.SimpleListFilter):
class VisitForm(forms.ModelForm):
"""Custom admin form for Visit."""
class Meta: # noqa
model = Visit
fields = '__all__'
......@@ -119,6 +118,7 @@ class ParticipationInline(admin.TabularInline):
class Media:
css = {"all": ("css/hide_admin_original.css",)}
def accept_selected_participations(modeladmin, request, queryset):
"""Accept selected participations in list view."""
for obj in queryset:
......@@ -182,7 +182,6 @@ class ParticipationAdmin(admin.ModelAdmin):
response.write(codecs.BOM_UTF8) # force response to be UTF-8
writer = csv.writer(response, delimiter=';')
writer.writerow(['first_name', 'last_name', 'school', 'grade',
'phone_number', 'scholarship'] + field_names)
......@@ -193,9 +192,9 @@ class ParticipationAdmin(admin.ModelAdmin):
name = User.objects.filter(
email=str(list_email[nb_user])).values('first_name', 'last_name', 'phone_number')
school = Student.objects.filter(
user__email=str(list_email[nb_user])).values('school', 'scholarship')
user__email=str(list_email[nb_user])).values('school', 'grade', 'scholarship')
row = writer.writerow([name[0]['first_name'], name[0]['last_name'], school[0]['school'], name[0]['phone_number'], school[0]['scholarship']] + [getattr(obj, field)
row = writer.writerow([name[0]['first_name'], name[0]['last_name'], school[0]['school'], school[0]['grade'], name[0]['phone_number'], school[0]['scholarship']] + [getattr(obj, field)
for field in field_names])
nb_user += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment