From f440a25e6dece8aa422f89d7d09bde63c820f9f9 Mon Sep 17 00:00:00 2001 From: emile Date: Fri, 12 Apr 2024 18:49:13 +0300 Subject: [PATCH] ss --- .../billing/__pycache__/urls.cpython-310.pyc | Bin 1014 -> 1073 bytes .../billing/__pycache__/views.cpython-310.pyc | Bin 3041 -> 3027 bytes .../billing/templates/invoice-details.html | 4 +-- osinaweb/billing/views.py | 23 ++++++++---------- .../__pycache__/settings.cpython-310.pyc | Bin 2779 -> 2779 bytes 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/osinaweb/billing/__pycache__/urls.cpython-310.pyc b/osinaweb/billing/__pycache__/urls.cpython-310.pyc index f1898f910c726271ab850d95128538f9c86cad91..dfe42e93ccedf87a0073a48b28d02329cd0a9dc5 100644 GIT binary patch delta 148 zcmeyyzL7&apO=@50SHb8Nv7RoW?*;>;vfS)AjbiSiyutXJ}Z&RoFbmelO>iSk;2i- zoX!;`o+25{peePPi7|yyp^7&>H7~U&u_RTuASF$|iU*nNrztTxlj#v(6kIeOsA#e` Rb33Ebo!P|2-d&9+ ztt#y*Ah-akP&6kFi000}z=1yjar2EM=bV5;`+bw`R*j0V3E{S_Ae}>r)PQ24*$JT z)-(6RbTquf((!1RGC3?6~Fk_VH#gixD9 z9i%Kj;*{}p0cV>CEqSE>yj4cAf>1?RLQpm@x+_H+l*cweg_wr<#5MWSEb~vs+Liyz zTns4<#(YHg`{E+TSLv7Mu1j*=^!~>^W&D2BXB%_(6{x=B@I{#DnYVdc{$Ot3?V!4g za27#FWsaX(;wq|Mvc#-_b*f!@15I8*I4@Uo-`D+0e?JwYgz+GV(&2s_^NaGg+z0MC zu*u9F!4lq)_58|5m@6yJts~0UFia2OHDydg5uWZ%eZWM2FL>?-0n=^yRlY^8${+LJ zk_+;jb*t&u<`#p9ry>}J3G?N|y1sP=6TFTI3Lj&iPfEhcb(}2iG7KKl-A_2_3DD!+{-w|9``I>mK%2a9gNDaBfN=l1>wcRku^^0kB0Y0(4>Ge5k_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3ytU!jH(Frf-?4 z3+&QY8D!~wY~UBakB}I^945tW7kZ~u?gm5_Qb-SmGH3z7VyXBE{DvRL-wjM z=J*zKH+S4g@YTD?FiP8eMB23QS@bT5ge&RlA11mcxk<*a$3b&CL;LCw-~7cutT9xHPa>4DYc8|t<8}_0 Pr_r@%?1q~s87}i*Mo~IQ diff --git a/osinaweb/billing/templates/invoice-details.html b/osinaweb/billing/templates/invoice-details.html index 5ae80e2f..ce498023 100644 --- a/osinaweb/billing/templates/invoice-details.html +++ b/osinaweb/billing/templates/invoice-details.html @@ -13,11 +13,11 @@
- +

Bill To: Winabig

-

Customer Details: 036466464

+

Customer Details: 036466464

diff --git a/osinaweb/billing/views.py b/osinaweb/billing/views.py index 468230f9..7b5b3223 100644 --- a/osinaweb/billing/views.py +++ b/osinaweb/billing/views.py @@ -2,11 +2,11 @@ from django.shortcuts import render, get_object_or_404 from django.utils import timezone from datetime import timedelta from .models import * -from django.http import JsonResponse -from django.http import HttpResponse +from django.http import JsonResponse, HttpResponse from django.template.loader import get_template from weasyprint import HTML + # LISTING def items (request, *args, **kwargs): context = { @@ -114,14 +114,11 @@ def invoice_details (request, invoice_id): def generate_pdf(request): - # Render the template - template = get_template('invoice.html') - html = template.render() - - # Create a PDF file - pdf_file = HTML(string=html).write_pdf() - - # Prepare HTTP response - response = HttpResponse(pdf_file, content_type='application/pdf') - response['Content-Disposition'] = 'filename="invoice.pdf"' - return response + template = get_template('invoice-details.html') + context = {} + html_string = template.render(context) + + pdf = HTML(string=html_string).write_pdf() + response = HttpResponse(pdf, content_type='application/pdf') + response['Content-Disposition'] = 'attachment; filename="my_pdf.pdf"' + return response \ No newline at end of file diff --git a/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc index 4e5439e83ee7cc259c0d1d73ab2496b854f96486..b6dc4773722bfc90f9a16ac0c872210abee7a2db 100644 GIT binary patch delta 19 ZcmcaDdRvq$pO=@50SI;nZ{)hj1pqXY1tI_d delta 19 ZcmcaDdRvq$pO=@50SMlCY~;Gg1pqaU1xf$_