mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-23 16:32:15 +00:00
Removed special characters from paperwork filenames - issue #103
This commit is contained in:
@@ -14,6 +14,7 @@ from z3c.rml import rml2pdf
|
||||
|
||||
from RIGS import models
|
||||
|
||||
import re
|
||||
|
||||
class InvoiceIndex(generic.ListView):
|
||||
model = models.Invoice
|
||||
@@ -63,8 +64,10 @@ class InvoicePrint(generic.View):
|
||||
|
||||
pdfData = buffer.read()
|
||||
|
||||
escapedEventName = re.sub('[^a-zA-Z0-9 \n\.]', '', object.name)
|
||||
|
||||
response = HttpResponse(content_type='application/pdf')
|
||||
response['Content-Disposition'] = "filename=Invoice %05d | %s.pdf" % (invoice.pk, object.name)
|
||||
response['Content-Disposition'] = "filename=Invoice %05d | %s.pdf" % (invoice.pk, escapedEventName)
|
||||
response.write(pdfData)
|
||||
return response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user