Blockchain changes 17 july 2024

This commit is contained in:
Ubuntu 2024-07-17 07:05:43 +00:00
parent 8efd0e495b
commit 8cced6a618
8 changed files with 74 additions and 6 deletions

View File

@ -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")

View File

@ -14,15 +14,15 @@
</head> </head>
<body style="margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif;font-size: 16px;"> <body style="margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif;font-size: 16px;">
<div style="max-width: 90vw; box-shadow: 0px 4px 27px 0px #00000040; margin: 16px auto;"> <div style="box-shadow: 0px 4px 27px 0px #00000040;">
<img src="/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/static/media/HeaderImageCertificate.png" style="width: 100%;"> <img src={{basepath}}/static/media/HeaderImageCertificate.png style="width: 100%;">
<table style="border-collapse: collapse; <table style="border-collapse: collapse;
display: flex; display: flex;
justify-content: center; justify-content: center;
margin: 0px 0 50px 0px"> margin: 0px 0 50px 0px">
<tr> <tr>
<td rowspan="4" style="text-align: center;"> <td rowspan="4" style="text-align: center;">
<img src="/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/static/media/verticalLineGolden.png" alt="v-line" style="height: 300px; <img src={{basepath}}/static/media/verticalLineGolden.png alt="v-line" style="height: 300px;
width: 30px; width: 30px;
position: relative; position: relative;
top: -70px; padding: 0 20px;"> top: -70px; padding: 0 20px;">
@ -36,7 +36,7 @@
</h2> </h2>
</td> </td>
<td rowspan="4" style="text-align: center;"> <td rowspan="4" style="text-align: center;">
<img src="/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/static/media/verticalLineGolden.png" alt="v-line" style="height: 300px; <img src={{basepath}}/static/media/verticalLineGolden.png alt="v-line" style="height: 300px;
width: 30px; width: 30px;
position: relative; position: relative;
top: 70px; padding: 0 20px;"> top: 70px; padding: 0 20px;">
@ -80,7 +80,13 @@
color: 252525;"> color: 252525;">
{{date}} {{date}}
</span> </span>
for which My Next Film has paid ____ MATIC. This is for which My Next Film has paid
<span style="font-family: Poppins;
font-size: 16px;
font-weight: 600;
text-align: center;
color: 252525;"> {{Matic}}
</span> MATIC. This is
also to certify that the above file is accessible at the also to certify that the above file is accessible at the
<span style="font-family: Poppins; <span style="font-family: Poppins;
font-size: 16px; font-size: 16px;
@ -124,7 +130,7 @@
<tr> <tr>
<td style="padding-left: 90px ; display: flex; justify-content: space-evenly;"> <td style="padding-left: 90px ; display: flex; justify-content: space-evenly;">
<div style="margin-left: -100px;"> <div style="margin-left: -100px;">
<img src="/home/ubuntu/Conversion_Kitchen_Code/kitchen_counter/static/media/DoogleFilm.png" alt="doodle" style="width: 144.7px; <img src="{{basepath}}/static/media/DoogleFilm.png" alt="doodle" style="width: 144.7px;
height: 121.06px;"> height: 121.06px;">
</div> </div>
<div> <div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 124 KiB