mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-18 17:52:21 -06:00
Added total IPv4/IPv6 counts to ipam.AggregateListView
This commit is contained in:
@@ -139,6 +139,21 @@ class AggregateListView(ObjectListView):
|
||||
edit_permissions = ['ipam.change_aggregate', 'ipam.delete_aggregate']
|
||||
template_name = 'ipam/aggregate_list.html'
|
||||
|
||||
def extra_context(self):
|
||||
ipv4_total = 0
|
||||
ipv6_total = 0
|
||||
|
||||
for a in self.queryset:
|
||||
if a.prefix.version == 4:
|
||||
ipv4_total += a.prefix.size
|
||||
elif a.prefix.version == 6:
|
||||
ipv6_total += a.prefix.size / 2**64
|
||||
|
||||
return {
|
||||
'ipv4_total': ipv4_total,
|
||||
'ipv6_total': ipv6_total,
|
||||
}
|
||||
|
||||
|
||||
def aggregate(request, pk):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user