From 5e92dac4ac94d55c57002cd9aab80ad86234725d Mon Sep 17 00:00:00 2001 From: devon-mar Date: Thu, 16 May 2024 20:58:12 -0700 Subject: [PATCH 1/3] Fix pagination when `pagination.per_page` is `""` --- netbox/utilities/paginator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/utilities/paginator.py b/netbox/utilities/paginator.py index ebf7a6257..1db815446 100644 --- a/netbox/utilities/paginator.py +++ b/netbox/utilities/paginator.py @@ -87,7 +87,7 @@ def get_paginate_count(request): pass if request.user.is_authenticated: - per_page = request.user.config.get('pagination.per_page', config.PAGINATE_COUNT) + per_page = request.user.config.get('pagination.per_page') or config.PAGINATE_COUNT return _max_allowed(per_page) return _max_allowed(config.PAGINATE_COUNT) From 233b9029e1c4d514ba07181687614d50bc773ee9 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 20 May 2024 11:36:35 -0400 Subject: [PATCH 2/3] Remove start date restriction from stale check for incomplete issues --- .github/workflows/close-incomplete-issues.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/close-incomplete-issues.yml b/.github/workflows/close-incomplete-issues.yml index 890970783..4d31d735e 100644 --- a/.github/workflows/close-incomplete-issues.yml +++ b/.github/workflows/close-incomplete-issues.yml @@ -30,4 +30,3 @@ jobs: This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically. - start-date: 2024-05-14 From 17799df72efc38c6856a6c0c4c1d48c3d13eb394 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 20 May 2024 14:48:42 -0700 Subject: [PATCH 3/3] 13764 Add contacts to IP views --- netbox/ipam/models/ip.py | 9 +++++---- netbox/ipam/views.py | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/netbox/ipam/models/ip.py b/netbox/ipam/models/ip.py index 2ae380d63..0b8e3a8df 100644 --- a/netbox/ipam/models/ip.py +++ b/netbox/ipam/models/ip.py @@ -18,6 +18,7 @@ from ipam.querysets import PrefixQuerySet from ipam.validators import DNSValidator from netbox.config import get_config from netbox.models import OrganizationalModel, PrimaryModel +from netbox.models.features import ContactsMixin __all__ = ( 'Aggregate', @@ -74,7 +75,7 @@ class RIR(OrganizationalModel): return reverse('ipam:rir', args=[self.pk]) -class Aggregate(GetAvailablePrefixesMixin, PrimaryModel): +class Aggregate(ContactsMixin, GetAvailablePrefixesMixin, PrimaryModel): """ An aggregate exists at the root level of the IP address space hierarchy in NetBox. Aggregates are used to organize the hierarchy and track the overall utilization of available address space. Each Aggregate is assigned to a RIR. @@ -206,7 +207,7 @@ class Role(OrganizationalModel): return reverse('ipam:role', args=[self.pk]) -class Prefix(GetAvailablePrefixesMixin, PrimaryModel): +class Prefix(ContactsMixin, GetAvailablePrefixesMixin, PrimaryModel): """ A Prefix represents an IPv4 or IPv6 network, including mask length. Prefixes can optionally be assigned to Sites and VRFs. A Prefix must be assigned a status and may optionally be assigned a used-define Role. A Prefix can also be @@ -486,7 +487,7 @@ class Prefix(GetAvailablePrefixesMixin, PrimaryModel): return min(utilization, 100) -class IPRange(PrimaryModel): +class IPRange(ContactsMixin, PrimaryModel): """ A range of IP addresses, defined by start and end addresses. """ @@ -695,7 +696,7 @@ class IPRange(PrimaryModel): return min(float(child_count) / self.size * 100, 100) -class IPAddress(PrimaryModel): +class IPAddress(ContactsMixin, PrimaryModel): """ An IPAddress represents an individual IPv4 or IPv6 address and its mask. The mask length should match what is configured in the real world. (Typically, only loopback interfaces are configured with /32 or /128 masks.) Like diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 2c00c318b..cab9058d8 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -9,6 +9,7 @@ from circuits.models import Provider from dcim.filtersets import InterfaceFilterSet from dcim.models import Interface, Site from netbox.views import generic +from tenancy.views import ObjectContactsView from utilities.query import count_related from utilities.tables import get_table_ordering from utilities.views import ViewTab, register_model_view @@ -405,6 +406,11 @@ class AggregateBulkDeleteView(generic.BulkDeleteView): table = tables.AggregateTable +@register_model_view(Aggregate, 'contacts') +class AggregateContactsView(ObjectContactsView): + queryset = Aggregate.objects.all() + + # # Prefix/VLAN roles # @@ -643,6 +649,11 @@ class PrefixBulkDeleteView(generic.BulkDeleteView): table = tables.PrefixTable +@register_model_view(Prefix, 'contacts') +class PrefixContactsView(ObjectContactsView): + queryset = Prefix.objects.all() + + # # IP Ranges # @@ -726,6 +737,11 @@ class IPRangeBulkDeleteView(generic.BulkDeleteView): table = tables.IPRangeTable +@register_model_view(IPRange, 'contacts') +class IPRangeContactsView(ObjectContactsView): + queryset = IPRange.objects.all() + + # # IP addresses # @@ -893,6 +909,11 @@ class IPAddressRelatedIPsView(generic.ObjectChildrenView): return parent.get_related_ips().restrict(request.user, 'view') +@register_model_view(IPAddress, 'contacts') +class IPAddressContactsView(ObjectContactsView): + queryset = IPAddress.objects.all() + + # # VLAN groups #