issue 207 add membershipSince, certificationDate membershipType

In certificates templates:
- Add membershipSince instead of issued or now()
- Add certificationDate instead of issued
- get membershipType for put there in template
This commit is contained in:
Cayo Puigdefabregas 2024-04-10 18:33:07 +02:00
parent edaaca6ec4
commit 32ad6edd9d
3 changed files with 9 additions and 8 deletions

View File

@ -87,7 +87,7 @@
<strong>CERTIFICA</strong><br /> <strong>CERTIFICA</strong><br />
<ul> <ul>
<li class="text-justify"> <li class="text-justify">
Que lentitat <b>{{ legalName }}</b>, amb NIF <b>{{ taxReference }}</b> i domicili a {{ streetAddress }} {{ postCode }} {{ city }} forma part com a entitat membre de {{ federation }} (ple dret/observadora) de <b>Lafede.cat - Federació d'Organitzacions per a la Justícia Global</b>, des de lAssemblea General Ordinària celebrada el {{ issue_date }} Que lentitat <b>{{ legalName }}</b>, amb NIF <b>{{ taxReference }}</b> i domicili a {{ streetAddress }} {{ postCode }} {{ city }} forma part com a entitat membre de {{ federation }} {% if membership_type == "full" %}ple dret{% endif %}{% if membership_type == "observer" %}observadora{% endif %} de <b>Lafede.cat - Federació d'Organitzacions per a la Justícia Global</b>, des de lAssemblea General Ordinària celebrada el {{ membership_since }}
</li> </li>
</ul> </ul>
<br /> <br />

View File

@ -87,7 +87,7 @@
<strong>CERTIFICA</strong><br /> <strong>CERTIFICA</strong><br />
<ul> <ul>
<li class="text-justify"> <li class="text-justify">
Que la entidad <b>{{ legalName }}</b>, con NIF <b>{{ taxReference }}</b> y domicilio {{ streetAddress }} {{ postCode }} {{ city }} forma parte como entidad miembro de {{ federation }} (pleno derecho/observadora) de <b>Lafede.cat - Federación de Organizaciones para la Justícia Global</b>, desde la Asamblea General Ordinaria celebrada el {{ issue_date }} Que la entidad <b>{{ legalName }}</b>, con NIF <b>{{ taxReference }}</b> y domicilio {{ streetAddress }} {{ postCode }} {{ city }} forma parte como entidad miembro de {{ federation }} {% if membership_type == "full" %}pleno derecho{% endif %}{% if membership_type == "observer" %}observadora{% endif %} de <b>Lafede.cat - Federación de Organizaciones para la Justícia Global</b>, desde la Asamblea General Ordinaria celebrada el {{ membership_since }}
</li> </li>
</ul> </ul>
<br /> <br />

View File

@ -1,7 +1,6 @@
import json import json
import base64 import base64
import qrcode import qrcode
import datetime
import weasyprint import weasyprint
import qrcode.image.svg import qrcode.image.svg
@ -282,21 +281,23 @@ class CredentialPdfView(MyWallet, TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context.update(dict(self.object.get_datas()))
img_sig = self.get_img_sign() img_sig = self.get_img_sign()
img_head = self.get_img_header() img_head = self.get_img_header()
img_foot = self.get_img_footer() img_foot = self.get_img_footer()
qr = self.generate_qr_code(self.url_id) qr = self.generate_qr_code(self.url_id)
issue_date_now = datetime.datetime.now() issue_date = context.get('certificationDate', '')
issue_date = context.get('issuedDate', issue_date_now) membership_since = context.get('membershipSince', '')
membership_type = context.get('membershipType', '').lower()
context.update(dict(self.object.get_datas()))
context.update({ context.update({
'object': self.object, 'object': self.object,
"image_signature": img_sig, "image_signature": img_sig,
"image_header": img_head, "image_header": img_head,
"image_footer": img_foot, "image_footer": img_foot,
"issue_date_now": issue_date_now.strftime("%d/%m/%Y"), "issue_date": issue_date,
"issue_date": issue_date.strftime("%d/%m/%Y"), "membership_since": membership_since,
"membership_type": membership_type,
"qr": qr, "qr": qr,
}) })
return context return context