From ab22a6de4a4c86ceb685f4395e6eb7c2b7627423 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 Aug 2017 00:39:59 +0200 Subject: [PATCH] fix filename in download view too --- src/tickets/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tickets/views.py b/src/tickets/views.py index db9ea339..8a109b07 100644 --- a/src/tickets/views.py +++ b/src/tickets/views.py @@ -40,7 +40,8 @@ class ShopTicketDownloadView(LoginRequiredMixin, SingleObjectMixin, View): def get(self, request, *args, **kwargs): response = HttpResponse(content_type='application/pdf') - response['Content-Disposition'] = 'attachment; filename="ticket_{pk}.pdf"'.format( + response['Content-Disposition'] = 'attachment; filename="{type}_ticket_{pk}.pdf"'.format( + type=self.get_object().shortname pk=self.get_object().pk ) response.write(self.get_object().generate_pdf().getvalue())