diff --git a/device/templates/details.html b/device/templates/details.html
index 5409cbb..16f973c 100644
--- a/device/templates/details.html
+++ b/device/templates/details.html
@@ -37,6 +37,9 @@
{% trans 'General details' %}
+
+ {% trans 'States' %}
+
{% trans 'User properties' %}
@@ -122,14 +125,30 @@
{% trans 'Current State' %}
-
-
{% trans 'State' %}
-
{{ device_states.0.state }}
-
-
-
{% trans 'Date' %}
-
{{ device_states.0.date|date:"SHORT_DATETIME_FORMAT" }}
-
+
+
+
+
+ {% trans 'State' %} |
+ {% trans 'User' %} |
+ {% trans 'Date' %} |
+
+
+
+ {% if device_states %}
+
+ {{ device_states.0.state }} |
+ {{ device_states.0.user.responsable_person|default:device_states.0.user.username }} |
+ {{ device_states.0.date|date:"SHORT_DATETIME_FORMAT" }} |
+
+ {% else %}
+
+ {% trans 'No state recorded.' %} |
+
+ {% endif %}
+
+
+
{% if last_note %}
@@ -143,7 +162,36 @@
-
+
+
+
+
{% trans 'History of States' %}
+
+
+
+
+ {% trans 'Date' %} |
+ {% trans 'User' %} |
+ {% trans 'State' %} |
+
+
+
+ {% for state_change in device_states %}
+
+ {{ state_change.state }} |
+
+ {{ state_change.user.responsable_person|default:state_change.user.username }} |
+ {{ state_change.date|date:"SHORT_DATETIME_FORMAT" }} |
+
+ {% empty %}
+
+ {% trans 'No state changes recorded.' %} |
+
+ {% endfor %}
+
+
+
+
diff --git a/device/views.py b/device/views.py
index 7f9c380..743c67e 100644
--- a/device/views.py
+++ b/device/views.py
@@ -116,7 +116,7 @@ class DetailsView(DashboardView, TemplateView):
'snapshot': last_evidence,
'lot_tags': lot_tags,
"state_definitions": StateDefinition.objects.filter(institution=self.request.user.institution).order_by('order'),
- "device_states": State.objects.filter(snapshot_uuid=uuid).order_by('date'),
+ "device_states": State.objects.filter(snapshot_uuid=uuid).order_by('-date'),
})
return context