diff --git a/device/templates/details.html b/device/templates/details.html index 9783057..0670988 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -30,7 +30,7 @@ {% trans 'Evidences' %}
- {{ d.signature }} + {{ d.signature }}
{% endfor %} diff --git a/device/views.py b/device/views.py index 12fb244..3c7118c 100644 --- a/device/views.py +++ b/device/views.py @@ -104,7 +104,7 @@ class DetailsView(DashboardView, TemplateView): context = super().get_context_data(**kwargs) self.object.initial() lot_tags = LotTag.objects.filter(owner=self.request.user.institution) - dpps = Proof.objects.filter(uuid_in=self.object.uuids) + dpps = Proof.objects.filter(uuid__in=self.object.uuids) context.update({ 'object': self.object, 'snapshot': self.object.get_last_evidence(), diff --git a/dhub/settings.py b/dhub/settings.py index 4b5c366..8c8ec69 100644 --- a/dhub/settings.py +++ b/dhub/settings.py @@ -90,6 +90,7 @@ INSTALLED_APPS = [ "admin", "api", "dpp", + "did", ] @@ -240,3 +241,7 @@ LOGGING = { SNAPSHOT_PATH="/tmp/" DATA_UPLOAD_MAX_NUMBER_FILES = 1000 COMMIT = config('COMMIT', default='') + +# DLT SETTINGS +TOKEN_DLT = config("TOKEN_DLT", default=None) +API_DLT = config("API_DLT", default=None) diff --git a/dpp/api_dlt.py b/dpp/api_dlt.py index 6bf95c0..8d90764 100644 --- a/dpp/api_dlt.py +++ b/dpp/api_dlt.py @@ -4,7 +4,7 @@ import logging from django.conf import settings from ereuseapi.methods import API -from dpp.models import Proof, Dpp +from dpp.models import Proof logger = logging.getLogger('django') @@ -31,11 +31,11 @@ PROOF_TYPE = { def connect_api(): - if not settings.get('TOKEN_DLT'): + if not settings.TOKEN_DLT: return - token_dlt = settings.get('TOKEN_DLT') - api_dlt = settings.get('API_DLT') + token_dlt = settings.TOKEN_DLT + api_dlt = settings.API_DLT return API(api_dlt, token_dlt, "ethereum") @@ -51,14 +51,14 @@ def register_dlt(chid, phid, proof_type=None): ALGORITHM, phid, proof_type, - settings.get('ID_FEDERATED') + settings.ID_FEDERATED ) return api.register_device( chid, ALGORITHM, phid, - settings.get('ID_FEDERATED') + settings.ID_FEDERATED ) @@ -72,7 +72,7 @@ def issuer_dpp_dlt(dpp): dpp, ALGORITHM, phid, - settings.get('ID_FEDERATED') + settings.ID_FEDERATED ) @@ -96,6 +96,11 @@ def save_proof(signature, ev_uuid, result, proof_type, user): def register_device_dlt(chid, phid, ev_uuid, user): + token_dlt = settings.TOKEN_DLT + api_dlt = settings.API_DLT + if not token_dlt or not api_dlt: + return + cny_a = 1 while cny_a: result = register_dlt(chid, phid) @@ -131,6 +136,11 @@ def register_device_dlt(chid, phid, ev_uuid, user): def register_passport_dlt(chid, phid, ev_uuid, user): + token_dlt = settings.TOKEN_DLT + api_dlt = settings.API_DLT + if not token_dlt or not api_dlt: + return + dpp = "{chid}:{phid}".format(chid=chid, phid=phid) if Proof.objects.filter(signature=dpp, type=PROOF_TYPE['IssueDPP']).exists(): return diff --git a/dpp/urls.py b/dpp/urls.py index 9ada14e..772286a 100644 --- a/dpp/urls.py +++ b/dpp/urls.py @@ -4,5 +4,5 @@ from dpp import views app_name = 'dpp' urlpatterns = [ - path("