This commit is contained in:
Cayo Puigdefabregas 2024-11-19 18:02:43 +01:00
parent 0d574cae63
commit cc350775ed
6 changed files with 29 additions and 11 deletions

View file

@ -30,7 +30,7 @@
<a href="#evidences" class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">{% trans 'Evidences' %}</a>
</li>
<li class="nav-item">
<a href="#dpps" class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">{% trans 'Dpps' %}</a>
<a href="#dpps" class="nav-link" data-bs-toggle="tab" data-bs-target="#dpps">{% trans 'Dpps' %}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'device:device_web' object.id %}" target="_blank">Web</a>
@ -242,7 +242,7 @@
<small class="text-muted">{{ d.timestamp }}</small>
</div>
<p class="mb-1">
<a href="{% url 'evidence:details' d.uuid %}">{{ d.signature }}</a>
<a href="{% url 'did:device_web' d.uuid %}">{{ d.signature }}</a>
</p>
</div>
{% endfor %}

View file

@ -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(),

View file

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

View file

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

View file

@ -4,5 +4,5 @@ from dpp import views
app_name = 'dpp'
urlpatterns = [
path("<int:proof_id>/", views.LotDashboardView.as_view(), name="proof"),
path("<int:proof_id>/", views.ProofView.as_view(), name="proof"),
]

View file

@ -11,3 +11,6 @@ xlrd==2.0.1
odfpy==1.4.1
pytz==2024.2
json-repair==0.30.0
setuptools==75.5.0
requests==2.32.3
wheel==0.45.0