Explorar o código

Replaced with pagination

Saria Hajjar %!s(int64=6) %!d(string=hai) anos
pai
achega
67f4d8fab5
Modificáronse 2 ficheiros con 10 adicións e 3 borrados
  1. 9 2
      netbox/ipam/views.py
  2. 1 1
      netbox/templates/ipam/ipaddress.html

+ 9 - 2
netbox/ipam/views.py

@@ -676,8 +676,15 @@ class IPAddressView(PermissionRequiredMixin, View):
             address=str(ipaddress.address)
         ).filter(
             vrf=ipaddress.vrf, address__net_contained_or_equal=str(ipaddress.address)
-        )[:50]
-        related_ips_table = tables.IPAddressTable(list(related_ips), orderable=False)
+        )
+
+        related_ips_table = tables.IPAddressTable(related_ips, orderable=False)
+
+        paginate = {
+            'paginator_class': EnhancedPaginator,
+            'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
+        }
+        RequestConfig(request, paginate).configure(related_ips_table)
 
         return render(request, 'ipam/ipaddress.html', {
             'ipaddress': ipaddress,

+ 1 - 1
netbox/templates/ipam/ipaddress.html

@@ -160,7 +160,7 @@
         {% if duplicate_ips_table.rows %}
             {% include 'panel_table.html' with table=duplicate_ips_table heading='Duplicate IP Addresses' panel_class='danger' %}
         {% endif %}
-        {% include 'panel_table.html' with table=related_ips_table heading='Related IP Addresses' panel_class='default noprint' %}
+        {% include 'utilities/obj_table.html' with table=related_ips_table table_template='panel_table.html' heading='Related IP Addresses' panel_class='default noprint' %}
 	</div>
 </div>
 {% endblock %}