Просмотр исходного кода

Fixes #4707: Fix prefix_count population on VLAN API serializer

Jeremy Stretch 5 лет назад
Родитель
Сommit
56f6698ba5
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      docs/release-notes/version-2.8.md
  2. 1 1
      netbox/ipam/api/views.py

+ 1 - 0
docs/release-notes/version-2.8.md

@@ -5,6 +5,7 @@
 ### Bug Fixes
 
 * [#4702](https://github.com/netbox-community/netbox/issues/4702) - Catch IntegrityError exception when adding a non-unique secret
+* [#4707](https://github.com/netbox-community/netbox/issues/4707) - Fix `prefix_count` population on VLAN API serializer
 
 ---
 

+ 1 - 1
netbox/ipam/api/views.py

@@ -276,7 +276,7 @@ class VLANViewSet(CustomFieldModelViewSet):
     queryset = VLAN.objects.prefetch_related(
         'site', 'group', 'tenant', 'role', 'tags'
     ).annotate(
-        prefix_count=get_subquery(Prefix, 'role')
+        prefix_count=get_subquery(Prefix, 'vlan')
     )
     serializer_class = serializers.VLANSerializer
     filterset_class = filters.VLANFilterSet