show datas from credential in credential view

This commit is contained in:
Cayo Puigdefabregas 2024-02-21 10:17:00 +01:00
parent 996288460c
commit d45be274ee

View file

@ -645,8 +645,9 @@ class VerificableCredential(models.Model):
return self.Status(self.status).label return self.Status(self.status).label
def get_datas(self): def get_datas(self):
data = json.loads(self.csv_data).items() data = self.render()
return data credential_subject = ujson.loads(data).get("credentialSubject", {})
return credential_subject.items()
def issue(self, did, domain=settings.DOMAIN.strip("/")): def issue(self, did, domain=settings.DOMAIN.strip("/")):
if self.status == self.Status.ISSUED: if self.status == self.Status.ISSUED:
@ -702,7 +703,7 @@ class VerificableCredential(models.Model):
context.update(d) context.update(d)
return context return context
def render(self, domain): def render(self, domain=""):
context = self.get_context(domain) context = self.get_context(domain)
template_name = 'credentials/{}'.format( template_name = 'credentials/{}'.format(
self.schema.file_schema self.schema.file_schema