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
This commit is contained in:
Thomas Flummer 2020-06-03 21:31:01 +02:00 committed by GitHub
parent 1c88ed8073
commit 944a42b597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 4 deletions

View File

@ -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