parent
498d7fc15e
commit
964b1013d9
2 changed files with 7 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
import logging
|
||||
|
||||
from datetime import timedelta
|
||||
from datetime import timedelta, datetime
|
||||
|
||||
from cachetools import lru_cache
|
||||
from flask import (abort, redirect, request, url_for, make_response, Response, render_template,
|
||||
|
@ -353,10 +353,14 @@ def receipt():
|
|||
abort(404)
|
||||
return
|
||||
|
||||
def format_date(timestamp):
|
||||
return datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d')
|
||||
|
||||
file_data = renderInvoiceToPdf(invoice, user_or_org)
|
||||
receipt_filename = 'quay-receipt-%s.pdf' % (format_date(invoice.date))
|
||||
return Response(file_data,
|
||||
mimetype="application/pdf",
|
||||
headers={"Content-Disposition": "attachment;filename=receipt.pdf"})
|
||||
headers={"Content-Disposition": "attachment;filename=" + receipt_filename})
|
||||
abort(404)
|
||||
|
||||
|
||||
|
|
Reference in a new issue