From b3b0452ade5c0b00fa063395e16da05b2de5eff5 Mon Sep 17 00:00:00 2001 From: Tudor Amariei Date: Wed, 11 Dec 2024 14:23:37 +0200 Subject: [PATCH] Fix grouping with no domain_id - this can happen if the db was altered (when testing) --- backend/hub/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/hub/views.py b/backend/hub/views.py index 29edc02..49a0195 100644 --- a/backend/hub/views.py +++ b/backend/hub/views.py @@ -75,6 +75,11 @@ def group_queryset_by_domain( for element in queryset: element_domain_pk: Domain = getattr(element, domain_variable_name) + + if not element_domain_pk: + logger.error(f"Element {element} does not have a domain.") + continue + if element_domain_pk not in queryset_by_domain_dict: queryset_by_domain_dict[element_domain_pk] = []