Commit 69cd04a5 authored by MOREAU Ulysse's avatar MOREAU Ulysse
Browse files

Add email in csv export

parent 5e8a79e3
...@@ -176,9 +176,10 @@ class CsvExportView(PermissionRequiredMixin, SingleObjectMixin, View): ...@@ -176,9 +176,10 @@ class CsvExportView(PermissionRequiredMixin, SingleObjectMixin, View):
response = HttpResponse(content_type='text/csv') response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = f'attachment; filename="{self.object.name}.csv"' response['Content-Disposition'] = f'attachment; filename="{self.object.name}.csv"'
writer = csv.writer(response) writer = csv.writer(response)
writer.writerow(['Username', 'Quantity', 'Paid', 'Customization', 'Option', 'Second Option', 'Quantity delivered']) writer.writerow(['Username', 'Email', 'Quantity', 'Paid', 'Customization', 'Option', 'Second Option', 'Quantity delivered'])
for oi in item.order_items.all(): for oi in item.order_items.all():
writer.writerow([str(oi.order.user.profile), writer.writerow([str(oi.order.user.profile),
oi.order.user.email,
oi.quantity, oi.quantity,
oi.order.paid, oi.order.paid,
oi.customization, oi.customization,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment