From 32ad6edd9de269ccf373d1c59bf0843eaa14f7d1 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 10 Apr 2024 18:33:07 +0200 Subject: [PATCH] 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 --- .../certificates/federation-membership_ca.html | 2 +- .../certificates/federation-membership_es.html | 2 +- idhub/user/views.py | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/idhub/templates/certificates/federation-membership_ca.html b/idhub/templates/certificates/federation-membership_ca.html index d237ca6..b3fd42b 100644 --- a/idhub/templates/certificates/federation-membership_ca.html +++ b/idhub/templates/certificates/federation-membership_ca.html @@ -87,7 +87,7 @@ CERTIFICA

diff --git a/idhub/templates/certificates/federation-membership_es.html b/idhub/templates/certificates/federation-membership_es.html index d1cd636..bf00906 100644 --- a/idhub/templates/certificates/federation-membership_es.html +++ b/idhub/templates/certificates/federation-membership_es.html @@ -87,7 +87,7 @@ CERTIFICA

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