From 13c78fb3c1cf3001c01ec903d66882d1b228d8cf Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 19 Sep 2024 18:22:17 +0200 Subject: [PATCH] api --- dashboard/templates/base.html | 6 ++++++ dhub/settings.py | 2 ++ dhub/urls.py | 1 + evidence/forms.py | 9 +++++++++ requirements.txt | 3 ++- 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index 3d046f1..f4a9307 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -143,6 +143,12 @@ + diff --git a/dhub/settings.py b/dhub/settings.py index 055828a..6e83032 100644 --- a/dhub/settings.py +++ b/dhub/settings.py @@ -43,6 +43,7 @@ INSTALLED_APPS = [ "django.contrib.staticfiles", 'django_extensions', 'django_bootstrap5', + 'django_tables2', "rest_framework", "login", "user", @@ -53,6 +54,7 @@ INSTALLED_APPS = [ "lot", "documents", "dashboard", + "api", ] diff --git a/dhub/urls.py b/dhub/urls.py index 90252d9..9bbd687 100644 --- a/dhub/urls.py +++ b/dhub/urls.py @@ -24,4 +24,5 @@ urlpatterns = [ path("evidence/", include("evidence.urls")), path("device/", include("device.urls")), path("lot/", include("lot.urls")), + path('api/', include('api.urls')), ] diff --git a/evidence/forms.py b/evidence/forms.py index be50ca8..d392f6e 100644 --- a/evidence/forms.py +++ b/evidence/forms.py @@ -56,6 +56,15 @@ class UserTagForm(forms.Form): def __init__(self, *args, **kwargs): self.uuid = kwargs.pop('uuid', None) + annotation = Annotation.objects.filter( + uuid=self.uuid, + type=Annotation.Type.SYSTEM, + key='CUSTOM_ID', + ).first() + + if annotation: + kwargs['initial'].update({'tag': annotation.value}) + super().__init__(*args, **kwargs) def clean(self): diff --git a/requirements.txt b/requirements.txt index 9d4492f..217d120 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,9 +3,10 @@ Django==5.0.6 django-bootstrap5==24.2 django-extensions==3.2.3 djangorestframework==3.15.1 +django-tables2==2.6.0 python-decouple==3.3 py-dmidecode==0.1.3 pandas==2.2.2 xlrd==2.0.1 odfpy==1.4.1 - +pytz==2024.2