From dafdf39ca8954ad393e8c511fb744008e5a37c9f Mon Sep 17 00:00:00 2001
From: Andrea Lepori <aleporia@gmail.com>
Date: Sat, 29 Jul 2023 18:15:26 +0200
Subject: add missing select related

---
 server/views.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'server')

diff --git a/server/views.py b/server/views.py
index 5f19ec5..79ab72f 100644
--- a/server/views.py
+++ b/server/views.py
@@ -1244,7 +1244,7 @@ def doclist(request, type_id):
             chips_groups += groups
 
     # run query
-    documents = Document.objects.filter(q_obj).select_related("personal_data", "medical_data", "document_type", "user")
+    documents = Document.objects.filter(q_obj).select_related("usercode", "personal_data", "medical_data", "document_type", "user")
 
     users = documents.values("usercode__first_name", "usercode__last_name")
 
@@ -1423,7 +1423,7 @@ def doclist_table(request, type_id):
             chips_groups += groups
 
     # run query
-    documents = Document.objects.filter(q_obj).select_related("personal_data", "medical_data", "document_type", "user")
+    documents = Document.objects.filter(q_obj).select_related("usercode", "personal_data", "medical_data", "document_type", "user")
 
     users = documents.values("usercode__first_name", "usercode__last_name")
 
@@ -1631,7 +1631,7 @@ def doclist_readonly(request):
             chips_groups += groups
 
     # run query
-    documents = Document.objects.filter(q_obj).select_related("personal_data", "medical_data", "document_type", "user")
+    documents = Document.objects.filter(q_obj).select_related("usercode", "personal_data", "medical_data", "document_type", "user")
 
     users = documents.values("usercode__first_name", "usercode__last_name")
 
-- 
cgit v1.2.1