diff --git a/kitchen_counter/lpp/certificate/__pycache__/createCertificate.cpython-311.pyc b/kitchen_counter/lpp/certificate/__pycache__/createCertificate.cpython-311.pyc index e98bcf4..fd85d3c 100644 Binary files a/kitchen_counter/lpp/certificate/__pycache__/createCertificate.cpython-311.pyc and b/kitchen_counter/lpp/certificate/__pycache__/createCertificate.cpython-311.pyc differ diff --git a/kitchen_counter/lpp/certificate/__pycache__/createCertificate.cpython-312.pyc b/kitchen_counter/lpp/certificate/__pycache__/createCertificate.cpython-312.pyc new file mode 100644 index 0000000..c2c9682 Binary files /dev/null and b/kitchen_counter/lpp/certificate/__pycache__/createCertificate.cpython-312.pyc differ diff --git a/kitchen_counter/lpp/certificate/certificate.pdf b/kitchen_counter/lpp/certificate/certificate.pdf index 7d66ea6..94d7daf 100644 Binary files a/kitchen_counter/lpp/certificate/certificate.pdf and b/kitchen_counter/lpp/certificate/certificate.pdf differ diff --git a/kitchen_counter/lpp/certificate/certificate/__pycache__/createCertificate.cpython-311.pyc b/kitchen_counter/lpp/certificate/certificate/__pycache__/createCertificate.cpython-311.pyc new file mode 100644 index 0000000..c464160 Binary files /dev/null and b/kitchen_counter/lpp/certificate/certificate/__pycache__/createCertificate.cpython-311.pyc differ diff --git a/kitchen_counter/lpp/certificate/certificate/certificate.pdf b/kitchen_counter/lpp/certificate/certificate/certificate.pdf new file mode 100644 index 0000000..ca9a0d1 Binary files /dev/null and b/kitchen_counter/lpp/certificate/certificate/certificate.pdf differ diff --git a/kitchen_counter/lpp/certificate/certificate/createCertificate.py b/kitchen_counter/lpp/certificate/certificate/createCertificate.py new file mode 100755 index 0000000..7324a90 --- /dev/null +++ b/kitchen_counter/lpp/certificate/certificate/createCertificate.py @@ -0,0 +1,62 @@ +import pdfkit +from django.shortcuts import render +from django.template.loader import get_template +from datetime import datetime +from datetime import date +from MNF.settings import BasePath +from users.models import Certificate +basepath = BasePath() + +# doc_fname = ( +# (str(x.translated_ppt.upload_ppt).split("/"))[-1]).split(".")[0] +# x.lpp_invoice_dialogue = f'{doc_fname}_Invoice.pdf' +# x.save() +# str1 = str(datetime.now()).split("-") +# from .utils import render_to_pdf + + +def certificateGenrate(name,file_from,Hash,projectname="NAN",matic="0"): + main = Certificate.objects.filter(user_name="MyNextFilm") + matic = int(matic) + matic = matic/10**18 + if main: + main1 = Certificate.objects.get(user_name="MyNextFilm") + ids = main1.id # blockchain_obj = UserCredentialsForBlockchain.objects.get(user=request.user) + + ids = ids+1 + main.update(id=ids) + else: + ids = 0 + serializer = Certificate() + serializer.user_name = "MyNextFilm" + serializer.id= 0 + serializer.save() + context = { + "name": name, + "file_from": file_from, + "date": date.today(), + "hash": Hash, + "id": ids, + 'Matic':"{:.4f}".format(matic), + 'File_name':projectname, + "basepath":basepath, + } + template = get_template( + f'{basepath}/lpp/templates/lpp/blockchainCertificate.html') + html = template.render(context) + options = { + 'page-size': 'A5', + 'zoom': 3.5, + 'margin-top': '0.0in', + 'margin-right': '0.0in', + 'margin-bottom': '0.0in', + 'margin-left': '0.0in', + 'enable-local-file-access': '', + 'orientation': 'Landscape' + } + pdfkit.from_string( + html, f'{basepath}/lpp/certificate/certificate.pdf', options=options) + return f'{basepath}/lpp/certificate/certificate.pdf' + +# certificateGenrate("pravesh yadav","PPT Conversiom", "qwefgfdsdfgdsdcvxs") + diff --git a/kitchen_counter/lpp/templates/lpp/blockchainCertificate.html b/kitchen_counter/lpp/templates/lpp/blockchainCertificate.html index 2257891..9f2e4dd 100755 --- a/kitchen_counter/lpp/templates/lpp/blockchainCertificate.html +++ b/kitchen_counter/lpp/templates/lpp/blockchainCertificate.html @@ -14,15 +14,15 @@
-- @@ -36,7 +36,7 @@ |
-
@@ -80,7 +80,13 @@
color: 252525;">
{{date}}
- for which My Next Film has paid ____ MATIC. This is
+ for which My Next Film has paid
+ {{Matic}}
+ MATIC. This is
also to certify that the above file is accessible at the
-
diff --git a/kitchen_counter/static/media/HeaderImageCertificate.png b/kitchen_counter/static/media/HeaderImageCertificate.png
index da7b04c..ec9c670 100755
Binary files a/kitchen_counter/static/media/HeaderImageCertificate.png and b/kitchen_counter/static/media/HeaderImageCertificate.png differ
|