From f99c7ee698145b5de261d267145097f87d4b4215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sat, 10 Feb 2024 10:50:05 +0100 Subject: [PATCH] Fetch permissions before rendering templates. --- src/utils/view_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/view_utils.py b/src/utils/view_utils.py index 7b2e416..9b752a8 100644 --- a/src/utils/view_utils.py +++ b/src/utils/view_utils.py @@ -120,4 +120,9 @@ def render(request, template_name, context=None): if context is None: context = {} context = base_context(request) | context + + # Make sure to fetch all permissions before rendering the template + # otherwise django-zen-queries will complain about database queries. + request.user.get_all_permissions() + return zen_queries_render(request, template_name, context)