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,
)
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/<string:id>/', view_func=DeviceDetailView.as_view('device_details')
)

View File

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