1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #9151: Child prefix counts not annotated on aggregates list under RIR view

This commit is contained in:
jeremystretch
2022-04-18 08:43:46 -04:00
parent 1636508a6a
commit 671e1aed9f
2 changed files with 3 additions and 2 deletions

View File

@@ -158,8 +158,8 @@ class RIRView(generic.ObjectView):
queryset = RIR.objects.all()
def get_extra_context(self, request, instance):
aggregates = Aggregate.objects.restrict(request.user, 'view').filter(
rir=instance
aggregates = Aggregate.objects.restrict(request.user, 'view').filter(rir=instance).annotate(
child_count=RawSQL('SELECT COUNT(*) FROM ipam_prefix WHERE ipam_prefix.prefix <<= ipam_aggregate.prefix', ())
)
aggregates_table = tables.AggregateTable(aggregates, exclude=('rir', 'utilization'))
aggregates_table.configure(request)