From 308e7ce217882ccd1a5242e222f4130fee9fc23e Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Thu, 4 Jan 2018 14:57:12 +0100
Subject: [PATCH] Make sure item comments are sorted by date

---
 app/templates/inventory/view_item.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/templates/inventory/view_item.html b/app/templates/inventory/view_item.html
index 97c0f1d..c695846 100644
--- a/app/templates/inventory/view_item.html
+++ b/app/templates/inventory/view_item.html
@@ -52,7 +52,7 @@
   </dl>
 
   <h4>Comments</h4>
-  {% for comment in item.comments %}
+  {% for comment in item.comments | sort(attribute='created_at') %}
   <div class="card border-light mb-3">
     <div class="card-header">
       {{ comment.user }} commented on {{ format_datetime(comment.created_at) }}
-- 
GitLab