From 94bd27bcf5e63283164e55b9c1a330a88ed667ed Mon Sep 17 00:00:00 2001 From: Miguel Teixeira <816267+CironAkono@users.noreply.github.com> Date: Sun, 24 Oct 2021 03:24:54 +0100 Subject: [PATCH 01/30] Fix interface icons on the device interfaces table --- netbox/dcim/tables/devices.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index c22e673b7..8939c01be 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -501,8 +501,8 @@ class InterfaceTable(DeviceComponentTable, BaseInterfaceTable, PathEndpointTable class DeviceInterfaceTable(InterfaceTable): name = tables.TemplateColumn( - template_code=' {{ value }}', order_by=Accessor('_name'), attrs={'td': {'class': 'text-nowrap'}} From b07e88869aa382fa45643470f05bd6f7abbb1780 Mon Sep 17 00:00:00 2001 From: Miguel Teixeira <816267+CironAkono@users.noreply.github.com> Date: Sun, 24 Oct 2021 03:31:29 +0100 Subject: [PATCH 02/30] Fix interfaces row colors on device interfaces table --- netbox/dcim/tables/devices.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 8939c01be..512022679 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -53,6 +53,16 @@ def get_cabletermination_row_class(record): return '' +def get_interface_row_class(record): + if not record.enabled: + return 'danger' + elif not record.is_connectable: + return 'primary' + else: + return get_cabletermination_row_class(record) + return '' + + def get_interface_state_attribute(record): """ Get interface enabled state as string to attach to DOM element. @@ -534,7 +544,7 @@ class DeviceInterfaceTable(InterfaceTable): 'cable', 'connection', 'actions', ) row_attrs = { - 'class': get_cabletermination_row_class, + 'class': get_interface_row_class, 'data-name': lambda record: record.name, 'data-enabled': get_interface_state_attribute, } From 11e2200acfcf479896c6697fb6bc152a56fe3558 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 3 Nov 2021 09:51:28 -0400 Subject: [PATCH 03/30] PRVB --- docs/release-notes/version-3.0.md | 4 ++++ netbox/netbox/settings.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 8b9c3733f..528b90846 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -1,5 +1,9 @@ # NetBox v3.0 +## v3.0.10 (FUTURE) + +--- + ## v3.0.9 (2021-11-03) ### Enhancements diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 0e99c7c06..ccf3b3752 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -16,7 +16,7 @@ from django.core.validators import URLValidator # Environment setup # -VERSION = '3.0.9' +VERSION = '3.0.10-dev' # Hostname HOSTNAME = platform.node() From 7b1335825be66074ef98db7bd96a5f85d8b42810 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 3 Nov 2021 10:47:17 -0400 Subject: [PATCH 04/30] Closes #7687: Update CentOS installation docs --- docs/installation/1-postgresql.md | 3 --- docs/installation/3-netbox.md | 7 ++++++- docs/installation/index.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/installation/1-postgresql.md b/docs/installation/1-postgresql.md index 43b12f0e8..4d49d8f43 100644 --- a/docs/installation/1-postgresql.md +++ b/docs/installation/1-postgresql.md @@ -21,9 +21,6 @@ This section entails the installation and configuration of a local PostgreSQL da sudo postgresql-setup --initdb ``` - !!! info - PostgreSQL 9.6 and later are available natively on CentOS 8.2. If using an earlier CentOS release, you may need to [install it from an RPM](https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/). - CentOS configures ident host-based authentication for PostgreSQL by default. Because NetBox will need to authenticate using a username and password, modify `/var/lib/pgsql/data/pg_hba.conf` to support MD5 authentication by changing `ident` to `md5` for the lines below: ```no-highlight diff --git a/docs/installation/3-netbox.md b/docs/installation/3-netbox.md index 87a64b325..bf1b27895 100644 --- a/docs/installation/3-netbox.md +++ b/docs/installation/3-netbox.md @@ -17,8 +17,13 @@ Begin by installing all system packages required by NetBox and its dependencies. === "CentOS" + !!! warning + CentOS 8 does not provide Python 3.7 or later via its native package manager. You will need to install it via some other means. [Here is an example](https://tecadmin.net/install-python-3-7-on-centos-8/) of installing Python 3.7 from source. + + Once you have Python 3.7 or later installed, install the remaining system packages: + ```no-highlight - sudo yum install -y gcc python36 python36-devel python3-pip libxml2-devel libxslt-devel libffi-devel libpq-devel openssl-devel redhat-rpm-config + sudo yum install -y gcc libxml2-devel libxslt-devel libffi-devel libpq-devel openssl-devel redhat-rpm-config ``` Before continuing with either platform, update pip (Python's package management tool) to its latest release: diff --git a/docs/installation/index.md b/docs/installation/index.md index bd1074b5e..ccfb8821d 100644 --- a/docs/installation/index.md +++ b/docs/installation/index.md @@ -1,6 +1,6 @@ # Installation -The installation instructions provided here have been tested to work on Ubuntu 20.04 and CentOS 8.2. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors. +The installation instructions provided here have been tested to work on Ubuntu 20.04 and CentOS 8.3. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors. The following sections detail how to set up a new instance of NetBox: From 8f1acb700d72467ffe7ae5c8502422a1eac0693d Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 4 Nov 2021 11:31:39 -0400 Subject: [PATCH 05/30] Fix ID list creation in API tests --- netbox/utilities/testing/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/testing/api.py b/netbox/utilities/testing/api.py index 8498f93ae..b3fa5704f 100644 --- a/netbox/utilities/testing/api.py +++ b/netbox/utilities/testing/api.py @@ -345,7 +345,7 @@ class APIViewTestCases: obj_perm.users.add(self.user) obj_perm.object_types.add(ContentType.objects.get_for_model(self.model)) - id_list = self._get_queryset().values_list('id', flat=True)[:3] + id_list = list(self._get_queryset().values_list('id', flat=True)[:3]) self.assertEqual(len(id_list), 3, "Insufficient number of objects to test bulk update") data = [ {'id': id, **self.bulk_update_data} for id in id_list @@ -416,7 +416,7 @@ class APIViewTestCases: # Target the three most recently created objects to avoid triggering recursive deletions # (e.g. with MPTT objects) - id_list = self._get_queryset().order_by('-id').values_list('id', flat=True)[:3] + id_list = list(self._get_queryset().order_by('-id').values_list('id', flat=True)[:3]) self.assertEqual(len(id_list), 3, "Insufficient number of objects to test bulk deletion") data = [{"id": id} for id in id_list] From 773fd47ca6f7a33238d63816e4a589c2f2f5687c Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 5 Nov 2021 08:45:57 -0400 Subject: [PATCH 06/30] Fixes #7752: Fix minimum version check under Python v3.10 --- docs/release-notes/version-3.0.md | 4 ++++ netbox/netbox/settings.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 528b90846..eaac82444 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -2,6 +2,10 @@ ## v3.0.10 (FUTURE) +### Bug Fixes + +* [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 + --- ## v3.0.9 (2021-11-03) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index ccf3b3752..b0c996141 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -4,6 +4,7 @@ import os import platform import re import socket +import sys import warnings from urllib.parse import urlsplit @@ -25,7 +26,7 @@ HOSTNAME = platform.node() BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Validate Python version -if platform.python_version_tuple() < ('3', '7'): +if sys.version_info < (3, 7): raise RuntimeError( f"NetBox requires Python 3.7 or higher (current: Python {platform.python_version()})" ) From e5d757866364a55795ca060f2fa4ecb5aed3cf2b Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 5 Nov 2021 11:10:17 -0400 Subject: [PATCH 07/30] Fixes #7750: Fix cable trace image link --- docs/core-functionality/devices.md | 10 ++++++++++ docs/models/dcim/cable.md | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/core-functionality/devices.md b/docs/core-functionality/devices.md index 67e3612b9..982ee3071 100644 --- a/docs/core-functionality/devices.md +++ b/docs/core-functionality/devices.md @@ -27,3 +27,13 @@ Device components represent discrete objects within a device which are used to t --- {!models/dcim/cable.md!} + +In the example below, three individual cables comprise a path between devices A and D: + +![Cable path](../media/models/dcim_cable_trace.png) + +Traced from Interface 1 on Device A, NetBox will show the following path: + +* Cable 1: Interface 1 to Front Port 1 +* Cable 2: Rear Port 1 to Rear Port 2 +* Cable 3: Front Port 2 to Interface 2 diff --git a/docs/models/dcim/cable.md b/docs/models/dcim/cable.md index 87ec68e03..43c0abfab 100644 --- a/docs/models/dcim/cable.md +++ b/docs/models/dcim/cable.md @@ -22,13 +22,3 @@ Each cable may be assigned a type, label, length, and color. Each cable is also ## Tracing Cables A cable may be traced from either of its endpoints by clicking the "trace" button. (A REST API endpoint also provides this functionality.) NetBox will follow the path of connected cables from this termination across the directly connected cable to the far-end termination. If the cable connects to a pass-through port, and the peer port has another cable connected, NetBox will continue following the cable path until it encounters a non-pass-through or unconnected termination point. The entire path will be displayed to the user. - -In the example below, three individual cables comprise a path between devices A and D: - -![Cable path](../media/models/dcim_cable_trace.png) - -Traced from Interface 1 on Device A, NetBox will show the following path: - -* Cable 1: Interface 1 to Front Port 1 -* Cable 2: Rear Port 1 to Rear Port 2 -* Cable 3: Front Port 2 to Interface 2 From 79f2f03fb241f35ff74bbd034df7ff26aa0be025 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 5 Nov 2021 13:26:18 -0400 Subject: [PATCH 08/30] Issues policy tweaks --- .github/ISSUE_TEMPLATE/bug_report.yaml | 5 +---- CONTRIBUTING.md | 12 ++++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 6c13631d9..fa773eb13 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -13,10 +13,7 @@ body: - type: input attributes: label: NetBox version - description: > - What version of NetBox are you currently running? (If you don't have access to the most - recent NetBox release, consider testing on our [demo instance](https://demo.netbox.dev/) - before opening a bug report to see if your issue has already been addressed.) + description: What version of NetBox are you currently running? placeholder: v3.0.9 validations: required: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a3b1f002..a3627a2b1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,14 +76,10 @@ free to add a comment with any additional justification for the feature. (However, note that comments with no substance other than a "+1" will be deleted. Please use GitHub's reactions feature to indicate your support.) -* Due to a large backlog of feature requests, we are not currently accepting -any proposals which substantially extend NetBox's functionality beyond its -current feature set. This includes the introduction of any new views or models -which have not already been proposed in an existing feature request. - -* Before filing a new feature request, consider raising your idea on the -mailing list first. Feedback you receive there will help validate and shape the -proposed feature before filing a formal issue. +* Before filing a new feature request, consider raising your idea in a +[GitHub discussion](https://github.com/netbox-community/netbox/discussions) +first. Feedback you receive there will help validate and shape the proposed +feature before filing a formal issue. * Good feature requests are very narrowly defined. Be sure to thoroughly describe the functionality and data model(s) being proposed. The more effort From 3eda8d84821cafcf8170f52be8300bdabdedb3ee Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 5 Nov 2021 13:31:36 -0400 Subject: [PATCH 09/30] Closes #7760: Add vid filter field to VLANs list --- docs/release-notes/version-3.0.md | 4 ++++ netbox/ipam/forms/filtersets.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index eaac82444..52ca0e5cf 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -2,6 +2,10 @@ ## v3.0.10 (FUTURE) +### Enhancements + +* [#7760](https://github.com/netbox-community/netbox/issues/7760) - Add `vid` filter field to VLANs list + ### Bug Fixes * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 diff --git a/netbox/ipam/forms/filtersets.py b/netbox/ipam/forms/filtersets.py index 8bc0f10fb..02fac75b3 100644 --- a/netbox/ipam/forms/filtersets.py +++ b/netbox/ipam/forms/filtersets.py @@ -1,3 +1,4 @@ +import django_filters from django import forms from django.utils.translation import gettext as _ @@ -409,7 +410,7 @@ class VLANFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilterFo field_groups = [ ['q', 'tag'], ['region_id', 'site_group_id', 'site_id'], - ['group_id', 'status', 'role_id'], + ['group_id', 'status', 'role_id', 'vid'], ['tenant_group_id', 'tenant_id'], ] q = forms.CharField( @@ -461,6 +462,10 @@ class VLANFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilterFo label=_('Role'), fetch_trigger='open' ) + vid = forms.IntegerField( + required=False, + label='VLAN ID' + ) tag = TagFilterField(model) From e04402ed570ad702f8f7f32ba5e2ecc3d51829f1 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 5 Nov 2021 13:40:38 -0400 Subject: [PATCH 10/30] Allow bypassing the pre-commit script with NOVALIDATE=1 --- scripts/git-hooks/pre-commit | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index 71b8cca6e..7a3d680a4 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -11,6 +11,7 @@ exec 1>&2 EXIT=0 RED='\033[0;31m' +YELLOW='\033[0;33m' NOCOLOR='\033[0m' if [ -d ./venv/ ]; then @@ -22,6 +23,11 @@ if [ -d ./venv/ ]; then fi fi +if [ ${NOVALIDATE} ]; then + echo "${YELLOW}Skipping validation checks${NOCOLOR}" + exit $EXIT +fi + echo "Validating PEP8 compliance..." pycodestyle --ignore=W504,E501 --exclude=node_modules netbox/ if [ $? != 0 ]; then From 9c2514fce4d8d6c46fddae8e79afe66631b468ae Mon Sep 17 00:00:00 2001 From: Nico Domino Date: Mon, 8 Nov 2021 14:15:26 +0100 Subject: [PATCH 11/30] feat: add outer_width to RackTable (#7766) * feat: add outer_width to RackTable * fix: add outer_units to column display * feat: add outer_depth to available columns --- netbox/dcim/tables/racks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/tables/racks.py b/netbox/dcim/tables/racks.py index f3d1cb7f8..982e2a47f 100644 --- a/netbox/dcim/tables/racks.py +++ b/netbox/dcim/tables/racks.py @@ -72,12 +72,20 @@ class RackTable(BaseTable): tags = TagColumn( url_name='dcim:rack_list' ) + outer_width = tables.TemplateColumn( + template_code="{{ record.outer_width }} {{ record.outer_unit }}", + verbose_name='Outer Width' + ) + outer_depth = tables.TemplateColumn( + template_code="{{ record.outer_depth }} {{ record.outer_unit }}", + verbose_name='Outer Depth' + ) class Meta(BaseTable.Meta): model = Rack fields = ( 'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'serial', 'asset_tag', 'type', - 'width', 'u_height', 'comments', 'device_count', 'get_utilization', 'get_power_utilization', 'tags', + 'width', 'outer_width', 'outer_depth', 'u_height', 'comments', 'device_count', 'get_utilization', 'get_power_utilization', 'tags', ) default_columns = ( 'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count', From 7b7afd3e7b75b810a48c1fe84f601f98ed2fef14 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Mon, 8 Nov 2021 08:24:14 -0500 Subject: [PATCH 12/30] Changelog for #7765 --- docs/release-notes/version-3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 52ca0e5cf..ddf32c680 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -9,6 +9,7 @@ ### Bug Fixes * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 +* [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table --- From b7aa44837fe5e152becda03ee1401c04766bc3dc Mon Sep 17 00:00:00 2001 From: Flo <52775027+FloEisen@users.noreply.github.com> Date: Mon, 8 Nov 2021 17:50:13 +0100 Subject: [PATCH 13/30] Add Mini-DIN 8 Console-Port-Type --- netbox/dcim/choices.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netbox/dcim/choices.py b/netbox/dcim/choices.py index 2f6228751..5a732fa8d 100644 --- a/netbox/dcim/choices.py +++ b/netbox/dcim/choices.py @@ -185,6 +185,7 @@ class ConsolePortTypeChoices(ChoiceSet): TYPE_RJ11 = 'rj-11' TYPE_RJ12 = 'rj-12' TYPE_RJ45 = 'rj-45' + TYPE_MINI_DIN_8 = 'mini-din-8' TYPE_USB_A = 'usb-a' TYPE_USB_B = 'usb-b' TYPE_USB_C = 'usb-c' @@ -202,6 +203,7 @@ class ConsolePortTypeChoices(ChoiceSet): (TYPE_RJ11, 'RJ-11'), (TYPE_RJ12, 'RJ-12'), (TYPE_RJ45, 'RJ-45'), + (TYPE_MINI_DIN_8, 'Mini-DIN 8'), )), ('USB', ( (TYPE_USB_A, 'USB Type A'), From 3f72492a59550469bc621df8071948f26c3fbacb Mon Sep 17 00:00:00 2001 From: Jason Yates Date: Tue, 9 Nov 2021 15:18:46 +0000 Subject: [PATCH 14/30] Fixed #7783 - Site location visual changes Updating site location list to visually match the /dcim/locations list where child locations are "indtended" with mdi-circle-small. Also removes the padding-left attribute on each row as it is no longer functional. --- netbox/templates/dcim/site.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html index 1ee8cfce0..2afa5376c 100644 --- a/netbox/templates/dcim/site.html +++ b/netbox/templates/dcim/site.html @@ -219,8 +219,8 @@ {% for location in locations %} - - + + {% for i in location.level|as_range %}{% endfor %} {{ location }} From 82210cc116bb54d63a80cf54ec431d14b32da7c8 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 9 Nov 2021 15:15:34 -0500 Subject: [PATCH 15/30] Changelog for #7783 --- docs/release-notes/version-3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index ddf32c680..8c2d3cbad 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -10,6 +10,7 @@ * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 * [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table +* [#7783](https://github.com/netbox-community/netbox/issues/7783) - Fix indentation of locations under site view --- From d08ed9fe5f69d736d566f8f5f6ebba7c3b25951a Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 9 Nov 2021 15:24:21 -0500 Subject: [PATCH 16/30] Fixes #7780: Preserve mutli-line values during CSV file import --- docs/release-notes/version-3.0.md | 1 + netbox/utilities/forms/fields.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 8c2d3cbad..6fe9948a0 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -10,6 +10,7 @@ * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 * [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table +* [#7780](https://github.com/netbox-community/netbox/issues/7780) - Preserve mutli-line values during CSV file import * [#7783](https://github.com/netbox-community/netbox/issues/7783) - Fix indentation of locations under site view --- diff --git a/netbox/utilities/forms/fields.py b/netbox/utilities/forms/fields.py index 2561c2e22..d9f1719ec 100644 --- a/netbox/utilities/forms/fields.py +++ b/netbox/utilities/forms/fields.py @@ -224,7 +224,7 @@ class CSVFileField(forms.FileField): return None csv_str = file.read().decode('utf-8').strip() - reader = csv.reader(csv_str.splitlines()) + reader = csv.reader(StringIO(csv_str)) headers, records = parse_csv(reader) return headers, records From 9dad7e4daf22bce29ce9318f849a81dac2647c33 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 9 Nov 2021 16:04:16 -0500 Subject: [PATCH 17/30] Fixes #7701: Fix conflation of assigned IP status & role in interface tables --- docs/release-notes/version-3.0.md | 1 + netbox/dcim/tables/template_code.py | 18 +++++++----------- netbox/project-static/dist/netbox-dark.css | Bin 788776 -> 788777 bytes netbox/project-static/dist/netbox-light.css | Bin 493600 -> 493601 bytes netbox/project-static/dist/netbox-print.css | Bin 1623462 -> 1623463 bytes netbox/project-static/styles/netbox.scss | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 6fe9948a0..1f3716383 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -8,6 +8,7 @@ ### Bug Fixes +* [#7701](https://github.com/netbox-community/netbox/issues/7701) - Fix conflation of assigned IP status & role in interface tables * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 * [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table * [#7780](https://github.com/netbox-community/netbox/issues/7780) - Preserve mutli-line values during CSV file import diff --git a/netbox/dcim/tables/template_code.py b/netbox/dcim/tables/template_code.py index 2f359e1b9..092fe3b95 100644 --- a/netbox/dcim/tables/template_code.py +++ b/netbox/dcim/tables/template_code.py @@ -40,17 +40,13 @@ DEVICEBAY_STATUS = """ INTERFACE_IPADDRESSES = """
- {% for ip in record.ip_addresses.all %} - - {{ ip }} - - {% endfor %} + {% for ip in record.ip_addresses.all %} + {% if ip.status != 'active' %} + {{ ip }} + {% else %} + {{ ip }} + {% endif %} + {% endfor %}
""" diff --git a/netbox/project-static/dist/netbox-dark.css b/netbox/project-static/dist/netbox-dark.css index b06cca0a11d640e5d728a81d25e0745825aa204a..bac0e589ac527f59e5f9cb369769f0e2c93501e1 100644 GIT binary patch delta 52 zcmV-40L%ZVk}#=~Fo1*sgaU*Egam{Iga(8Mgb0KQgbK6^(fgO5rU(U>r=ANVm(KkQ K47UXQ3nUE$+7q7u delta 46 zcmV+}0MY-ck}#-}Fo1*sgaU*Egam{Iga(8Mgb0KQgbK6^(fgC2s3(`t{R<4Y1^f#n E4VeHDumAu6 diff --git a/netbox/project-static/dist/netbox-light.css b/netbox/project-static/dist/netbox-light.css index cf06883a981bf8a07b403e0a852b2a0a12b620af..3ae6b577918c8c0e2ee575ae28d6e8002fd11ebb 100644 GIT binary patch delta 31 ncmZ25L2ls$xrP?T7N!>F7M2#)7Pc+y&+8bCwm+|9x8wu>wF7M2#)7Pc+y&+Df1+q1K7e_O|H!U+J_zYD?u diff --git a/netbox/project-static/dist/netbox-print.css b/netbox/project-static/dist/netbox-print.css index 7e565c3d5be6b900a59495cd008ed04c0bad79ad..7974e338d08659ae8a191e608fd831cf2d961d6a 100644 GIT binary patch delta 87 zcmV-d0I2__i({vYV}OJKgaU*Egam{Iga(8Mgb0KQgbIWUgbaiYgbsucgb;)ggc5`k tgcO7ogcgJsv=|Pnm#~5n1(!(g7ZjJxs~8WLXR8<;lQ0qnw^*wfP8tO?9UuSz delta 81 zcmZ49oxH3&xuJ!zg{g(Pg{6hHg{_6Xg` Date: Tue, 9 Nov 2021 16:08:11 -0500 Subject: [PATCH 18/30] Changelog for #7740 --- docs/release-notes/version-3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 1f3716383..ef99c4a0e 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -4,6 +4,7 @@ ### Enhancements +* [#7740](https://github.com/netbox-community/netbox/issues/7740) - Add mini-DIN 8 console port type * [#7760](https://github.com/netbox-community/netbox/issues/7760) - Add `vid` filter field to VLANs list ### Bug Fixes From 3ad773beb3bfadf2b6ecaa5dd843acba3a2fb49e Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 9 Nov 2021 16:46:58 -0500 Subject: [PATCH 19/30] Fixes #7741: Fix 404 when attaching multiple images in succession --- docs/release-notes/version-3.0.md | 1 + netbox/extras/models/models.py | 2 ++ netbox/extras/views.py | 6 +----- .../inc/image_attachments_panel.html | 2 +- netbox/utilities/templatetags/helpers.py | 20 +++++++++++++++++++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index ef99c4a0e..7a3005421 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -10,6 +10,7 @@ ### Bug Fixes * [#7701](https://github.com/netbox-community/netbox/issues/7701) - Fix conflation of assigned IP status & role in interface tables +* [#7741](https://github.com/netbox-community/netbox/issues/7741) - Fix 404 when attaching multiple images in succession * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 * [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table * [#7780](https://github.com/netbox-community/netbox/issues/7780) - Preserve mutli-line values during CSV file import diff --git a/netbox/extras/models/models.py b/netbox/extras/models/models.py index 75f5242d3..2c56f2f0f 100644 --- a/netbox/extras/models/models.py +++ b/netbox/extras/models/models.py @@ -357,6 +357,8 @@ class ImageAttachment(BigIDModel): objects = RestrictedQuerySet.as_manager() + clone_fields = ('content_type', 'object_id') + class Meta: ordering = ('name', 'pk') # name may be non-unique diff --git a/netbox/extras/views.py b/netbox/extras/views.py index d39f50c79..b0387c73d 100644 --- a/netbox/extras/views.py +++ b/netbox/extras/views.py @@ -475,11 +475,7 @@ class ImageAttachmentEditView(generic.ObjectEditView): def alter_obj(self, instance, request, args, kwargs): if not instance.pk: # Assign the parent object based on URL kwargs - try: - app_label, model = request.GET.get('content_type').split('.') - except (AttributeError, ValueError): - raise Http404("Content type not specified") - content_type = get_object_or_404(ContentType, app_label=app_label, model=model) + content_type = get_object_or_404(ContentType, pk=request.GET.get('content_type')) instance.parent = get_object_or_404(content_type.model_class(), pk=request.GET.get('object_id')) return instance diff --git a/netbox/templates/inc/image_attachments_panel.html b/netbox/templates/inc/image_attachments_panel.html index ca7312901..9706a7ffe 100644 --- a/netbox/templates/inc/image_attachments_panel.html +++ b/netbox/templates/inc/image_attachments_panel.html @@ -44,7 +44,7 @@ {% if perms.extras.add_imageattachment %} diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index 1695c8257..5b5534321 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -6,6 +6,7 @@ from typing import Dict, Any import yaml from django import template from django.conf import settings +from django.contrib.contenttypes.models import ContentType from django.template.defaultfilters import date from django.urls import NoReverseMatch, reverse from django.utils import timezone @@ -78,6 +79,25 @@ def meta(obj, attr): return getattr(obj._meta, attr, '') +@register.filter() +def content_type(obj): + """ + Return the ContentType for the given object. + """ + return ContentType.objects.get_for_model(obj) + + +@register.filter() +def content_type_id(obj): + """ + Return the ContentType ID for the given object. + """ + content_type = ContentType.objects.get_for_model(obj) + if content_type: + return content_type.pk + return None + + @register.filter() def viewname(model, action): """ From 53e52aeaa80a5f9a5584be42e7586678583a5a9d Mon Sep 17 00:00:00 2001 From: kkthxbye-code Date: Thu, 11 Nov 2021 14:05:39 +0100 Subject: [PATCH 20/30] Fix sorting devicebay table by status --- netbox/dcim/tables/devices.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 675f7d777..c8559458c 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -653,7 +653,8 @@ class DeviceBayTable(DeviceComponentTable): } ) status = tables.TemplateColumn( - template_code=DEVICEBAY_STATUS + template_code=DEVICEBAY_STATUS, + order_by=Accessor('installed_device__status') ) installed_device = tables.Column( linkify=True From 27d7400c362ac479b2dcc3ff6e58a532019016c5 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 11 Nov 2021 10:23:38 -0500 Subject: [PATCH 21/30] Fixes #7802: Differentiate ID and VID columns in VLANs table --- docs/release-notes/version-3.0.md | 3 ++- netbox/ipam/tables/vlans.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 7a3005421..966bcc428 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -13,8 +13,9 @@ * [#7741](https://github.com/netbox-community/netbox/issues/7741) - Fix 404 when attaching multiple images in succession * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 * [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table -* [#7780](https://github.com/netbox-community/netbox/issues/7780) - Preserve mutli-line values during CSV file import +* [#7780](https://github.com/netbox-community/netbox/issues/7780) - Preserve multi-line values during CSV file import * [#7783](https://github.com/netbox-community/netbox/issues/7783) - Fix indentation of locations under site view +* [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table --- diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index 84b250f87..ffa6c5f40 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -93,7 +93,7 @@ class VLANTable(BaseTable): pk = ToggleColumn() vid = tables.TemplateColumn( template_code=VLAN_LINK, - verbose_name='ID' + verbose_name='VID' ) site = tables.Column( linkify=True From 726e4df54b8e472cfbd944a26f5a0f17b0ebe46b Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 11 Nov 2021 11:31:51 -0500 Subject: [PATCH 22/30] Changelog for #7791 --- docs/release-notes/version-3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 966bcc428..c8d188e3d 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -15,6 +15,7 @@ * [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table * [#7780](https://github.com/netbox-community/netbox/issues/7780) - Preserve multi-line values during CSV file import * [#7783](https://github.com/netbox-community/netbox/issues/7783) - Fix indentation of locations under site view +* [#7791](https://github.com/netbox-community/netbox/issues/7791) - Enable sorting device bays table by installed device status * [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table --- From 251abdb4ddc6224e9c41dfe493614767985ee889 Mon Sep 17 00:00:00 2001 From: CironAkono <816267+CironAkono@users.noreply.github.com> Date: Thu, 11 Nov 2021 16:36:13 +0000 Subject: [PATCH 23/30] Apply suggestions from code review Co-authored-by: Jeremy Stretch --- netbox/dcim/tables/devices.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 512022679..4be5c7634 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -56,11 +56,9 @@ def get_cabletermination_row_class(record): def get_interface_row_class(record): if not record.enabled: return 'danger' - elif not record.is_connectable: + elif record.is_virtual: return 'primary' - else: - return get_cabletermination_row_class(record) - return '' + return get_cabletermination_row_class(record) def get_interface_state_attribute(record): From 3cb8c5db28481d8c66e6833705300d8c9b13f135 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 11 Nov 2021 12:10:47 -0500 Subject: [PATCH 24/30] Fixes #7654: Fix assignment of members to virtual chassis with initial position of zero --- docs/release-notes/version-3.0.md | 1 + netbox/dcim/forms/object_create.py | 10 ++++++++-- netbox/templates/dcim/virtualchassis.html | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index c8d188e3d..fdbf58908 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -9,6 +9,7 @@ ### Bug Fixes +* [#7564](https://github.com/netbox-community/netbox/issues/7564) - Fix assignment of members to virtual chassis with initial position of zero * [#7701](https://github.com/netbox-community/netbox/issues/7701) - Fix conflation of assigned IP status & role in interface tables * [#7741](https://github.com/netbox-community/netbox/issues/7741) - Fix 404 when attaching multiple images in succession * [#7752](https://github.com/netbox-community/netbox/issues/7752) - Fix minimum version check under Python v3.10 diff --git a/netbox/dcim/forms/object_create.py b/netbox/dcim/forms/object_create.py index 7577ad355..ea797335d 100644 --- a/netbox/dcim/forms/object_create.py +++ b/netbox/dcim/forms/object_create.py @@ -117,12 +117,18 @@ class VirtualChassisCreateForm(BootstrapMixin, CustomFieldModelForm): 'name', 'domain', 'region', 'site_group', 'site', 'rack', 'members', 'initial_position', 'tags', ] + def clean(self): + if self.cleaned_data['members'] and self.cleaned_data['initial_position'] is None: + raise forms.ValidationError({ + 'initial_position': "A position must be specified for the first VC member." + }) + def save(self, *args, **kwargs): instance = super().save(*args, **kwargs) # Assign VC members - if instance.pk: - initial_position = self.cleaned_data.get('initial_position') or 1 + if instance.pk and self.cleaned_data['members']: + initial_position = self.cleaned_data.get('initial_position', 1) for i, member in enumerate(self.cleaned_data['members'], start=initial_position): member.virtual_chassis = instance member.vc_position = i diff --git a/netbox/templates/dcim/virtualchassis.html b/netbox/templates/dcim/virtualchassis.html index 12088e892..60c20a5dc 100644 --- a/netbox/templates/dcim/virtualchassis.html +++ b/netbox/templates/dcim/virtualchassis.html @@ -61,7 +61,7 @@ {{ vc_member }} - {% badge vc_member.vc_position %} + {% badge vc_member.vc_position show_empty=True %} {% if object.master == vc_member %} From 2f064cdfd1429ee835062cdb9d88ffc64f3ddf9a Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 11 Nov 2021 12:30:28 -0500 Subject: [PATCH 25/30] Changelog for #7767 --- docs/release-notes/version-3.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index fdbf58908..366f0bca0 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -6,6 +6,7 @@ * [#7740](https://github.com/netbox-community/netbox/issues/7740) - Add mini-DIN 8 console port type * [#7760](https://github.com/netbox-community/netbox/issues/7760) - Add `vid` filter field to VLANs list +* [#7767](https://github.com/netbox-community/netbox/issues/7767) - Add visual aids to interfaces table for type, enabled status ### Bug Fixes From a7990942276f125694e7fa33f6d5c58925574aee Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 11 Nov 2021 15:38:34 -0500 Subject: [PATCH 26/30] Fixes #7788: Improve XSS mitigation in Markdown renderer --- docs/release-notes/version-3.0.md | 1 + netbox/utilities/templatetags/helpers.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 366f0bca0..5ba2ac35f 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -17,6 +17,7 @@ * [#7766](https://github.com/netbox-community/netbox/issues/7766) - Add missing outer dimension columns to rack table * [#7780](https://github.com/netbox-community/netbox/issues/7780) - Preserve multi-line values during CSV file import * [#7783](https://github.com/netbox-community/netbox/issues/7783) - Fix indentation of locations under site view +* [#7788](https://github.com/netbox-community/netbox/issues/7788) - Improve XSS mitigation in Markdown renderer * [#7791](https://github.com/netbox-community/netbox/issues/7791) - Enable sorting device bays table by installed device status * [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index 5b5534321..b047bb698 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -40,14 +40,19 @@ def render_markdown(value): """ Render text as Markdown """ + schemes = '|'.join(settings.ALLOWED_URL_SCHEMES) + # Strip HTML tags value = strip_tags(value) # Sanitize Markdown links - schemes = '|'.join(settings.ALLOWED_URL_SCHEMES) - pattern = fr'\[(.+)\]\((?!({schemes})).*:(.+)\)' + pattern = fr'\[([^\]]+)\]\((?!({schemes})).*:(.+)\)' value = re.sub(pattern, '[\\1](\\3)', value, flags=re.IGNORECASE) + # Sanitize Markdown reference links + pattern = fr'\[(.+)\]:\w?(?!({schemes})).*:(.+)' + value = re.sub(pattern, '[\\1]: \\3', value, flags=re.IGNORECASE) + # Render Markdown html = markdown(value, extensions=['fenced_code', 'tables']) From 0b705553a565edbd03c808fc8376f109b2c653fb Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 11 Nov 2021 16:16:54 -0500 Subject: [PATCH 27/30] Fixes #7809: Add missing export template support for various models --- docs/release-notes/version-3.0.md | 1 + netbox/extras/forms/models.py | 2 +- netbox/extras/models/customfields.py | 2 +- netbox/extras/models/models.py | 8 ++++---- netbox/extras/models/tags.py | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 5ba2ac35f..27c8fffad 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -20,6 +20,7 @@ * [#7788](https://github.com/netbox-community/netbox/issues/7788) - Improve XSS mitigation in Markdown renderer * [#7791](https://github.com/netbox-community/netbox/issues/7791) - Enable sorting device bays table by installed device status * [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table +* [#7809](https://github.com/netbox-community/netbox/issues/7809) - Add missing export template support for various models --- diff --git a/netbox/extras/forms/models.py b/netbox/extras/forms/models.py index 7e462e62b..61c341334 100644 --- a/netbox/extras/forms/models.py +++ b/netbox/extras/forms/models.py @@ -70,7 +70,7 @@ class CustomLinkForm(BootstrapMixin, forms.ModelForm): class ExportTemplateForm(BootstrapMixin, forms.ModelForm): content_type = ContentTypeChoiceField( queryset=ContentType.objects.all(), - limit_choices_to=FeatureQuery('custom_links') + limit_choices_to=FeatureQuery('export_templates') ) class Meta: diff --git a/netbox/extras/models/customfields.py b/netbox/extras/models/customfields.py index c74bb0cde..245079863 100644 --- a/netbox/extras/models/customfields.py +++ b/netbox/extras/models/customfields.py @@ -31,7 +31,7 @@ class CustomFieldManager(models.Manager.from_queryset(RestrictedQuerySet)): return self.get_queryset().filter(content_types=content_type) -@extras_features('webhooks') +@extras_features('webhooks', 'export_templates') class CustomField(ChangeLoggedModel): content_types = models.ManyToManyField( to=ContentType, diff --git a/netbox/extras/models/models.py b/netbox/extras/models/models.py index 2c56f2f0f..1b20cc79c 100644 --- a/netbox/extras/models/models.py +++ b/netbox/extras/models/models.py @@ -9,7 +9,7 @@ from django.db import models from django.http import HttpResponse from django.urls import reverse from django.utils import timezone -from django.utils.formats import date_format, time_format +from django.utils.formats import date_format from rest_framework.utils.encoders import JSONEncoder from extras.choices import * @@ -36,7 +36,7 @@ __all__ = ( # Webhooks # -@extras_features('webhooks') +@extras_features('webhooks', 'export_templates') class Webhook(ChangeLoggedModel): """ A Webhook defines a request that will be sent to a remote application when an object is created, updated, and/or @@ -175,7 +175,7 @@ class Webhook(ChangeLoggedModel): # Custom links # -@extras_features('webhooks') +@extras_features('webhooks', 'export_templates') class CustomLink(ChangeLoggedModel): """ A custom link to an external representation of a NetBox object. The link text and URL fields accept Jinja2 template @@ -234,7 +234,7 @@ class CustomLink(ChangeLoggedModel): # Export templates # -@extras_features('webhooks') +@extras_features('webhooks', 'export_templates') class ExportTemplate(ChangeLoggedModel): content_type = models.ForeignKey( to=ContentType, diff --git a/netbox/extras/models/tags.py b/netbox/extras/models/tags.py index afeeee53d..da2016875 100644 --- a/netbox/extras/models/tags.py +++ b/netbox/extras/models/tags.py @@ -14,7 +14,7 @@ from utilities.querysets import RestrictedQuerySet # Tags # -@extras_features('webhooks') +@extras_features('webhooks', 'export_templates') class Tag(ChangeLoggedModel, TagBase): color = ColorField( default=ColorChoices.COLOR_GREY From 9f8068e8d12da7ac9399e622fa2c4ec5d74fe452 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 11 Nov 2021 16:21:27 -0500 Subject: [PATCH 28/30] Fixes #7808: Fix reference values for content type under custom field import form --- docs/release-notes/version-3.0.md | 1 + netbox/utilities/forms/fields.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 27c8fffad..03a4d3a59 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -20,6 +20,7 @@ * [#7788](https://github.com/netbox-community/netbox/issues/7788) - Improve XSS mitigation in Markdown renderer * [#7791](https://github.com/netbox-community/netbox/issues/7791) - Enable sorting device bays table by installed device status * [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table +* [#7808](https://github.com/netbox-community/netbox/issues/7808) - Fix reference values for content type under custom field import form * [#7809](https://github.com/netbox-community/netbox/issues/7809) - Add missing export template support for various models --- diff --git a/netbox/utilities/forms/fields.py b/netbox/utilities/forms/fields.py index d9f1719ec..bca293b0b 100644 --- a/netbox/utilities/forms/fields.py +++ b/netbox/utilities/forms/fields.py @@ -304,7 +304,7 @@ class CSVMultipleContentTypeField(forms.ModelMultipleChoiceField): app_label, model = name.split('.') ct_filter |= Q(app_label=app_label, model=model) return list(ContentType.objects.filter(ct_filter).values_list('pk', flat=True)) - return super().prepare_value(value) + return f'{value.app_label}.{value.model}' # From daf6c8e327ff3128449a3add684a76bd7fef4268 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 12 Nov 2021 08:23:58 -0500 Subject: [PATCH 29/30] Fixes #7814: Fix restriction of user & group objects in GraphQL API queries --- docs/release-notes/version-3.0.md | 1 + netbox/users/graphql/types.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 03a4d3a59..324cda952 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -22,6 +22,7 @@ * [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table * [#7808](https://github.com/netbox-community/netbox/issues/7808) - Fix reference values for content type under custom field import form * [#7809](https://github.com/netbox-community/netbox/issues/7809) - Add missing export template support for various models +* [#7814](https://github.com/netbox-community/netbox/issues/7814) - Fix restriction of user & group objects in GraphQL API queries --- diff --git a/netbox/users/graphql/types.py b/netbox/users/graphql/types.py index 3315744b9..d948686c6 100644 --- a/netbox/users/graphql/types.py +++ b/netbox/users/graphql/types.py @@ -19,7 +19,7 @@ class GroupType(DjangoObjectType): @classmethod def get_queryset(cls, queryset, info): - return RestrictedQuerySet(model=Group) + return RestrictedQuerySet(model=Group).restrict(info.context.user, 'view') class UserType(DjangoObjectType): @@ -34,4 +34,4 @@ class UserType(DjangoObjectType): @classmethod def get_queryset(cls, queryset, info): - return RestrictedQuerySet(model=User) + return RestrictedQuerySet(model=User).restrict(info.context.user, 'view') From 49e77841e06f47f29294c9b69dca97c87285a2d7 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 12 Nov 2021 08:36:33 -0500 Subject: [PATCH 30/30] Release v3.0.10 --- .github/ISSUE_TEMPLATE/bug_report.yaml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yaml | 2 +- docs/release-notes/version-3.0.md | 2 +- netbox/netbox/settings.py | 2 +- requirements.txt | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index fa773eb13..79fb0e334 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -14,7 +14,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v3.0.9 + placeholder: v3.0.10 validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index a6fc342be..76944eecb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -14,7 +14,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v3.0.9 + placeholder: v3.0.10 validations: required: true - type: dropdown diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 324cda952..4c263e78f 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -1,6 +1,6 @@ # NetBox v3.0 -## v3.0.10 (FUTURE) +## v3.0.10 (2021-11-12) ### Enhancements diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index b0c996141..83655d0c5 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -17,7 +17,7 @@ from django.core.validators import URLValidator # Environment setup # -VERSION = '3.0.10-dev' +VERSION = '3.0.10' # Hostname HOSTNAME = platform.node() diff --git a/requirements.txt b/requirements.txt index c537a39c3..84ad0c398 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,13 +15,13 @@ djangorestframework==3.12.4 drf-yasg[validation]==1.20.0 graphene_django==2.15.0 gunicorn==20.1.0 -Jinja2==3.0.2 +Jinja2==3.0.3 Markdown==3.3.4 markdown-include==0.6.0 mkdocs-material==7.3.6 netaddr==0.8.0 Pillow==8.4.0 -psycopg2-binary==2.9.1 +psycopg2-binary==2.9.2 PyYAML==6.0 svgwrite==1.4.1 tablib==3.1.0