def get_image(id): loan = Loan.get_client_loan(Loan, id) file_path = os.path.join("./application/static", loan.collaterals[0].image) abs_path = os.path.abspath(os.path.dirname(__file__)) path = abs_path.replace("/views/Loan", "/static") return send_file(path + "/" + loan.collaterals[0].image, mimetype='image/*')
def view_letter(id): loan = Loan.get_client_loan(Loan, id) file_path = os.path.join("./application/static", loan.G_LC_letter) abs_path = os.path.abspath(os.path.dirname(__file__)) path = abs_path.replace("/views/Loan", "/static") print(loan.G_LC_letter) return send_file(path + "/" + loan.G_LC_letter, mimetype='application/pdf')
def get_file(filename, id): loan = Loan.get_client_loan(Loan, id) for file in loan.collaterals[0].files: if file.filename == filename: file_path = os.path.join("./application/static", file.filename) abs_path = os.path.abspath(os.path.dirname(__file__)) path = abs_path.replace("/views/Loan", "/static") return send_file(path + "/" + file.filename, mimetype='application/pdf')