From 95d685b333e035258dfe26ed855c4dbda4ebc1fd Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Tue, 13 Jun 2023 20:41:43 +0530 Subject: [PATCH] fixed object view annotation --- netbox/ipam/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index a9e9d5872..804d1603c 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -889,7 +889,8 @@ class VLANGroupListView(generic.ObjectListView): @register_model_view(VLANGroup) class VLANGroupView(generic.ObjectView): queryset = VLANGroup.objects.annotate( - utilization=count_related(VLAN, 'group') / (F('max_vid') - F('min_vid') + 1.0) * 100 + vlan_count=count_related(VLAN, 'group'), + utilization=Round(F('vlan_count') / (F('max_vid') - F('min_vid') + 1.0) * 100, 2) ).prefetch_related('tags') def get_extra_context(self, request, instance):