From 70691ff9724e0a8d009a312e7c93f5597d95b902 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 29 Nov 2023 21:31:29 -0500 Subject: [PATCH] doorcontrol: Improve performance of door access report views --- doorcontrol/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doorcontrol/views.py b/doorcontrol/views.py index 4268fc8..5c0424f 100644 --- a/doorcontrol/views.py +++ b/doorcontrol/views.py @@ -61,7 +61,10 @@ class BaseAccessReport(PermissionRequiredMixin, ListView): def get_queryset(self): return ( - super().get_queryset().filter(timestamp__range=self._get_timestamp_range()) + super() + .get_queryset() + .filter(timestamp__range=self._get_timestamp_range()) + .select_related("door") ) def get_context_data(self, **kwargs):