errors in snapshots

This commit is contained in:
Cayo Puigdefabregas 2022-04-13 20:15:40 +02:00
parent a0a52d8248
commit 379a2efca2
2 changed files with 10 additions and 3 deletions

View File

@ -25,6 +25,7 @@ from ereuse_devicehub.inventory.forms import (
UploadSnapshotForm, UploadSnapshotForm,
) )
from ereuse_devicehub.labels.forms import PrintLabelsForm 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.action.models import Trade
from ereuse_devicehub.resources.device.models import Computer, DataStorage, Device from ereuse_devicehub.resources.device.models import Computer, DataStorage, Device
from ereuse_devicehub.resources.documents.device_row import ActionRow, DeviceRow from ereuse_devicehub.resources.documents.device_row import ActionRow, DeviceRow
@ -557,8 +558,12 @@ class SnapshotListView(GenericMixView):
def get_context(self): def get_context(self):
lots = self.get_lots() lots = self.get_lots()
snapshot_errors = SnapshotErrors.query.filter(
SnapshotErrors.owner == current_user
).order_by(SnapshotErrors.created.desc())
self.context = { self.context = {
'snapshot_errors': snapshot_errors,
'lots': lots, 'lots': lots,
'version': __version__, 'version': __version__,
} }
@ -579,7 +584,9 @@ devices.add_url_rule(
view_func=NewTradeDocumentView.as_view('trade_document_add'), view_func=NewTradeDocumentView.as_view('trade_document_add'),
) )
devices.add_url_rule('/device/', view_func=DeviceListView.as_view('devicelist')) 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( devices.add_url_rule(
'/device/<string:id>/', view_func=DeviceDetailView.as_view('device_details') '/device/<string:id>/', view_func=DeviceDetailView.as_view('device_details')
) )

View File

@ -33,7 +33,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for snap in snapshots_errors %} {% for snap in snapshot_errors %}
<tr> <tr>
<td> <td>
{{ snap.wbid }} {{ snap.wbid }}
@ -46,7 +46,7 @@
<td> <td>
{{ snap.description }} {{ snap.description }}
</td> </td>
<td>{{ dev.created.strftime('%H:%M %d-%m-%Y') }}</td> <td>{{ snap.created.strftime('%H:%M %d-%m-%Y') }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>