From fb9336a2ae4be0c7d389f0c94fe69768179b3127 Mon Sep 17 00:00:00 2001 From: Vicente Olivert Riera Date: Fri, 19 Jan 2024 16:11:34 +0900 Subject: [PATCH] Audit logs: Show projects for services Before, when displaying the audit logs for services, there was no information regarding when a project was added on a service, or modified, or deleted. That information is useful when tracking things down while debugging, so let's add it. --- promgen/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/promgen/views.py b/promgen/views.py index 21447a479..48307eb18 100644 --- a/promgen/views.py +++ b/promgen/views.py @@ -230,6 +230,12 @@ def get_queryset(self): content_type_id=ContentType.objects.get_for_model(models.Rule).id, object_id__in=obj.rule_set.values_list("id", flat=True), ) + if key == "service": + # Only services may have projects + qset |= Q( + content_type_id=ContentType.objects.get_for_model(models.Project).id, + object_id__in=obj.project_set.values_list("id", flat=True), + ) if key == "project": # Only projects may have exporters qset |= Q(