|
|
@@ -6,7 +6,7 @@ from django.shortcuts import get_object_or_404, redirect, render
|
|
|
from django_tables2 import RequestConfig
|
|
|
|
|
|
from dcim.models import Device, Interface
|
|
|
-from utilities.paginator import EnhancedPaginator
|
|
|
+from utilities.paginator import EnhancedPaginator, get_paginate_count
|
|
|
from utilities.utils import get_subquery
|
|
|
from utilities.views import (
|
|
|
BulkCreateView, BulkDeleteView, BulkEditView, BulkImportView, ObjectView, ObjectDeleteView, ObjectEditView,
|
|
|
@@ -305,7 +305,7 @@ class AggregateView(ObjectView):
|
|
|
|
|
|
paginate = {
|
|
|
'paginator_class': EnhancedPaginator,
|
|
|
- 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
|
|
|
+ 'per_page': get_paginate_count(request)
|
|
|
}
|
|
|
RequestConfig(request, paginate).configure(prefix_table)
|
|
|
|
|
|
@@ -463,7 +463,7 @@ class PrefixPrefixesView(ObjectView):
|
|
|
|
|
|
paginate = {
|
|
|
'paginator_class': EnhancedPaginator,
|
|
|
- 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
|
|
|
+ 'per_page': get_paginate_count(request)
|
|
|
}
|
|
|
RequestConfig(request, paginate).configure(prefix_table)
|
|
|
|
|
|
@@ -507,7 +507,7 @@ class PrefixIPAddressesView(ObjectView):
|
|
|
|
|
|
paginate = {
|
|
|
'paginator_class': EnhancedPaginator,
|
|
|
- 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
|
|
|
+ 'per_page': get_paginate_count(request)
|
|
|
}
|
|
|
RequestConfig(request, paginate).configure(ip_table)
|
|
|
|
|
|
@@ -599,7 +599,8 @@ class IPAddressView(ObjectView):
|
|
|
# Exclude anycast IPs if this IP is anycast
|
|
|
if ipaddress.role == IPAddressRoleChoices.ROLE_ANYCAST:
|
|
|
duplicate_ips = duplicate_ips.exclude(role=IPAddressRoleChoices.ROLE_ANYCAST)
|
|
|
- duplicate_ips_table = tables.IPAddressTable(list(duplicate_ips), orderable=False)
|
|
|
+ # Limit to a maximum of 10 duplicates displayed here
|
|
|
+ duplicate_ips_table = tables.IPAddressTable(duplicate_ips[:10], orderable=False)
|
|
|
|
|
|
# Related IP table
|
|
|
related_ips = IPAddress.objects.restrict(request.user, 'view').exclude(
|
|
|
@@ -611,7 +612,7 @@ class IPAddressView(ObjectView):
|
|
|
|
|
|
paginate = {
|
|
|
'paginator_class': EnhancedPaginator,
|
|
|
- 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
|
|
|
+ 'per_page': get_paginate_count(request)
|
|
|
}
|
|
|
RequestConfig(request, paginate).configure(related_ips_table)
|
|
|
|
|
|
@@ -619,6 +620,7 @@ class IPAddressView(ObjectView):
|
|
|
'ipaddress': ipaddress,
|
|
|
'parent_prefixes_table': parent_prefixes_table,
|
|
|
'duplicate_ips_table': duplicate_ips_table,
|
|
|
+ 'more_duplicate_ips': duplicate_ips.count() > 10,
|
|
|
'related_ips_table': related_ips_table,
|
|
|
})
|
|
|
|
|
|
@@ -771,7 +773,7 @@ class VLANGroupVLANsView(ObjectView):
|
|
|
|
|
|
paginate = {
|
|
|
'paginator_class': EnhancedPaginator,
|
|
|
- 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
|
|
|
+ 'per_page': get_paginate_count(request),
|
|
|
}
|
|
|
RequestConfig(request, paginate).configure(vlan_table)
|
|
|
|
|
|
@@ -785,6 +787,7 @@ class VLANGroupVLANsView(ObjectView):
|
|
|
return render(request, 'ipam/vlangroup_vlans.html', {
|
|
|
'vlan_group': vlan_group,
|
|
|
'first_available_vlan': vlan_group.get_next_available_vid(),
|
|
|
+ 'bulk_querystring': 'group_id={}'.format(vlan_group.pk),
|
|
|
'vlan_table': vlan_table,
|
|
|
'permissions': permissions,
|
|
|
})
|
|
|
@@ -831,7 +834,7 @@ class VLANInterfacesView(ObjectView):
|
|
|
|
|
|
paginate = {
|
|
|
'paginator_class': EnhancedPaginator,
|
|
|
- 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
|
|
|
+ 'per_page': get_paginate_count(request)
|
|
|
}
|
|
|
RequestConfig(request, paginate).configure(members_table)
|
|
|
|
|
|
@@ -852,7 +855,7 @@ class VLANVMInterfacesView(ObjectView):
|
|
|
|
|
|
paginate = {
|
|
|
'paginator_class': EnhancedPaginator,
|
|
|
- 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
|
|
|
+ 'per_page': get_paginate_count(request)
|
|
|
}
|
|
|
RequestConfig(request, paginate).configure(members_table)
|
|
|
|