From 944a42b5978f66239730730144430219182e5e65 Mon Sep 17 00:00:00 2001 From: Thomas Flummer Date: Wed, 3 Jun 2020 21:31:01 +0200 Subject: [PATCH] Added header row and public or not column (#512) Also changed to show all numbers, and not only public ones, since this for adding to the phone system and all numbers need to be added --- src/phonebook/views.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/phonebook/views.py b/src/phonebook/views.py index d1083985..f01e0dce 100644 --- a/src/phonebook/views.py +++ b/src/phonebook/views.py @@ -36,11 +36,24 @@ class DectExportView( "Content-Disposition" ] = f'attachment; filename="{self.camp.slug}-dect-export-{timezone.now()}.csv"' writer = csv.writer(response) - for dect in DectRegistration.objects.filter( - camp=self.camp, publish_in_phonebook=True - ): + writer.writerow( + [ + "number", + "letters", + "description", + "activation_code", + "publish_in_phonebook", + ] + ) + for dect in DectRegistration.objects.filter(camp=self.camp): writer.writerow( - [dect.number, dect.letters, dect.description, dect.activation_code] + [ + dect.number, + dect.letters, + dect.description, + dect.activation_code, + dect.publish_in_phonebook, + ] ) return response