From 379a2efca217016b3c297bcd920dc6a93784a62a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 13 Apr 2022 20:15:40 +0200 Subject: [PATCH] errors in snapshots --- ereuse_devicehub/inventory/views.py | 9 ++++++++- ereuse_devicehub/templates/inventory/snapshot_list.html | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 5ccf6961..9812ffad 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -25,6 +25,7 @@ from ereuse_devicehub.inventory.forms import ( UploadSnapshotForm, ) from ereuse_devicehub.labels.forms import PrintLabelsForm +from ereuse_devicehub.parser.models import SnapshotErrors from ereuse_devicehub.resources.action.models import Trade from ereuse_devicehub.resources.device.models import Computer, DataStorage, Device from ereuse_devicehub.resources.documents.device_row import ActionRow, DeviceRow @@ -557,8 +558,12 @@ class SnapshotListView(GenericMixView): def get_context(self): lots = self.get_lots() + snapshot_errors = SnapshotErrors.query.filter( + SnapshotErrors.owner == current_user + ).order_by(SnapshotErrors.created.desc()) self.context = { + 'snapshot_errors': snapshot_errors, 'lots': lots, 'version': __version__, } @@ -579,7 +584,9 @@ devices.add_url_rule( view_func=NewTradeDocumentView.as_view('trade_document_add'), ) devices.add_url_rule('/device/', view_func=DeviceListView.as_view('devicelist')) -devices.add_url_rule('/snapshot/', view_func=SnapshotListView.as_view('snapshotlist')) +devices.add_url_rule( + '/snapshot/errors/', view_func=SnapshotListView.as_view('snapshot_errors_list') +) devices.add_url_rule( '/device//', view_func=DeviceDetailView.as_view('device_details') ) diff --git a/ereuse_devicehub/templates/inventory/snapshot_list.html b/ereuse_devicehub/templates/inventory/snapshot_list.html index 2eb07016..f34e7930 100644 --- a/ereuse_devicehub/templates/inventory/snapshot_list.html +++ b/ereuse_devicehub/templates/inventory/snapshot_list.html @@ -33,7 +33,7 @@ - {% for snap in snapshots_errors %} + {% for snap in snapshot_errors %} {{ snap.wbid }} @@ -46,7 +46,7 @@ {{ snap.description }} - {{ dev.created.strftime('%H:%M %d-%m-%Y') }} + {{ snap.created.strftime('%H:%M %d-%m-%Y') }} {% endfor %}