fix filename in download view too

This commit is contained in:
Thomas Steen Rasmussen 2017-08-20 00:39:59 +02:00
parent c6ee407751
commit ab22a6de4a

View file

@ -40,7 +40,8 @@ class ShopTicketDownloadView(LoginRequiredMixin, SingleObjectMixin, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
response = HttpResponse(content_type='application/pdf') 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 pk=self.get_object().pk
) )
response.write(self.get_object().generate_pdf().getvalue()) response.write(self.get_object().generate_pdf().getvalue())