From b1440fddfa97bba7fda60ede3f3322e00ba744a0 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 18 Jul 2024 17:21:22 +0200 Subject: [PATCH] new structure --- dashboard/mixins.py | 2 + dashboard/templates/base.html | 16 +- dashboard/views.py | 28 +- device/migrations/0001_initial.py | 369 +----------------- ...rand_alter_device_devicehub_id_and_more.py | 33 -- device/migrations/0002_device_model.py | 18 + device/migrations/0003_device_manufacturer.py | 18 + ...nent_type_remove_computer_type_and_more.py | 73 ---- ..._dhid_bk_remove_device_phid_bk_and_more.py | 46 --- device/models.py | 192 +++------ device/templates/details.html | 198 ++++------ device/urls.py | 6 +- device/views.py | 108 ++--- example/snapshot1.json | 1 + lot/migrations/0001_initial.py | 44 ++- lot/models.py | 40 +- lot/templates/list_lots.html | 35 +- lot/urls.py | 4 +- lot/views.py | 38 +- reset.sh | 4 + snapshot/migrations/0001_initial.py | 44 +-- .../migrations/0002_alter_snapshot_uuid.py | 18 - .../0003_remove_snapshot_start_time.py | 17 - snapshot/migrations/0004_anotation.py | 41 -- .../0005_annotation_delete_anotation.py | 44 --- snapshot/models.py | 85 ++-- snapshot/parse.py | 71 ++-- snapshot/views.py | 9 +- snapshot/xapian.py | 43 +- user/management/commands/add_user.py | 20 +- user/migrations/0001_initial.py | 2 +- utils/constants.py | 14 + 32 files changed, 471 insertions(+), 1210 deletions(-) delete mode 100644 device/migrations/0002_alter_device_brand_alter_device_devicehub_id_and_more.py create mode 100644 device/migrations/0002_device_model.py create mode 100644 device/migrations/0003_device_manufacturer.py delete mode 100644 device/migrations/0003_remove_component_type_remove_computer_type_and_more.py delete mode 100644 device/migrations/0004_remove_device_dhid_bk_remove_device_phid_bk_and_more.py create mode 100644 example/snapshot1.json create mode 100644 reset.sh delete mode 100644 snapshot/migrations/0002_alter_snapshot_uuid.py delete mode 100644 snapshot/migrations/0003_remove_snapshot_start_time.py delete mode 100644 snapshot/migrations/0004_anotation.py delete mode 100644 snapshot/migrations/0005_annotation_delete_anotation.py diff --git a/dashboard/mixins.py b/dashboard/mixins.py index df9d6d1..bd93513 100644 --- a/dashboard/mixins.py +++ b/dashboard/mixins.py @@ -5,6 +5,7 @@ from django.core.exceptions import PermissionDenied from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic.base import TemplateView from device.models import Device +from lot.models import LotTag class Http403(PermissionDenied): @@ -37,6 +38,7 @@ class DashboardView(LoginRequiredMixin): 'section': self.section, 'path': resolve(self.request.path).url_name, 'user': self.request.user, + 'lot_tags': LotTag.objects.filter(owner=self.request.user) }) return context diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html index 8134c90..296dd35 100644 --- a/dashboard/templates/base.html +++ b/dashboard/templates/base.html @@ -103,21 +103,13 @@ {% trans 'Lots' %}