From f6d4d54d06cc0f07c50116040e0fd1f983c64483 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 22 Mar 2022 09:37:57 -0400 Subject: [PATCH 1/4] Fixes #8932: Fix error when setting null value for interface rf_role via REST API --- docs/release-notes/version-3.1.md | 1 + netbox/dcim/api/serializers.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.1.md b/docs/release-notes/version-3.1.md index 9e6d8ad96..1637a18a1 100644 --- a/docs/release-notes/version-3.1.md +++ b/docs/release-notes/version-3.1.md @@ -14,6 +14,7 @@ * [#8813](https://github.com/netbox-community/netbox/issues/8813) - Retain global search bar query after submitting * [#8820](https://github.com/netbox-community/netbox/issues/8820) - Fix navbar background color in dark mode * [#8850](https://github.com/netbox-community/netbox/issues/8850) - Show airflow field on device REST API serializer when config context data is included +* [#8932](https://github.com/netbox-community/netbox/issues/8932) - Fix error when setting null value for interface `rf_role` via REST API --- diff --git a/netbox/dcim/api/serializers.py b/netbox/dcim/api/serializers.py index 2d555e756..6be27217c 100644 --- a/netbox/dcim/api/serializers.py +++ b/netbox/dcim/api/serializers.py @@ -619,8 +619,8 @@ class InterfaceSerializer(PrimaryModelSerializer, LinkTerminationSerializer, Con parent = NestedInterfaceSerializer(required=False, allow_null=True) bridge = NestedInterfaceSerializer(required=False, allow_null=True) lag = NestedInterfaceSerializer(required=False, allow_null=True) - mode = ChoiceField(choices=InterfaceModeChoices, allow_blank=True, required=False) - rf_role = ChoiceField(choices=WirelessRoleChoices, required=False, allow_null=True) + mode = ChoiceField(choices=InterfaceModeChoices, required=False, allow_blank=True) + rf_role = ChoiceField(choices=WirelessRoleChoices, required=False, allow_blank=True) rf_channel = ChoiceField(choices=WirelessChannelChoices, required=False, allow_blank=True) untagged_vlan = NestedVLANSerializer(required=False, allow_null=True) tagged_vlans = SerializedPKRelatedField( From 3c0a04ebb5beb4f1ad38690d3368d72b3b28a411 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 22 Mar 2022 09:50:38 -0400 Subject: [PATCH 2/4] Fixes #8935: Correct ordering of next/previous racks to use naturalized names --- docs/release-notes/version-3.1.md | 1 + netbox/dcim/views.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.1.md b/docs/release-notes/version-3.1.md index 1637a18a1..6bfd28bca 100644 --- a/docs/release-notes/version-3.1.md +++ b/docs/release-notes/version-3.1.md @@ -15,6 +15,7 @@ * [#8820](https://github.com/netbox-community/netbox/issues/8820) - Fix navbar background color in dark mode * [#8850](https://github.com/netbox-community/netbox/issues/8850) - Show airflow field on device REST API serializer when config context data is included * [#8932](https://github.com/netbox-community/netbox/issues/8932) - Fix error when setting null value for interface `rf_role` via REST API +* [#8935](https://github.com/netbox-community/netbox/issues/8935) - Correct ordering of next/previous racks to use naturalized names --- diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 87c4828d5..6697a44cc 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -609,8 +609,8 @@ class RackView(generic.ObjectView): peer_racks = peer_racks.filter(location=instance.location) else: peer_racks = peer_racks.filter(location__isnull=True) - next_rack = peer_racks.filter(name__gt=instance.name).order_by('name').first() - prev_rack = peer_racks.filter(name__lt=instance.name).order_by('-name').first() + next_rack = peer_racks.filter(_name__gt=instance._name).first() + prev_rack = peer_racks.filter(_name__lt=instance._name).reverse().first() reservations = RackReservation.objects.restrict(request.user, 'view').filter(rack=instance) power_feeds = PowerFeed.objects.restrict(request.user, 'view').filter(rack=instance).prefetch_related( From b8f62f36f96b1fe5e3b5c9e49eede101f00e8133 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 22 Mar 2022 10:59:43 -0400 Subject: [PATCH 3/4] Update testing instructions --- docs/development/getting-started.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/development/getting-started.md b/docs/development/getting-started.md index 0e892bd4a..3c02c01bf 100644 --- a/docs/development/getting-started.md +++ b/docs/development/getting-started.md @@ -124,8 +124,10 @@ The demo data is provided in JSON format and loaded into an empty database using Prior to committing any substantial changes to the code base, be sure to run NetBox's test suite to catch any potential errors. Tests are run using the `test` management command. Remember to ensure the Python virtual environment is active before running this command. Also keep in mind that these commands are executed in the `/netbox/` directory, not the root directory of the repository. +When running tests, it's advised to use the special testing configuration file that ships with NetBox. This ensures that tests are run with the same configuration parameters consistently. To override your local configuration when running tests, set the `NETBOX_CONFIGURATION` environment variable to `netbox.configuration_testing`. + ```no-highlight -$ python manage.py test +$ NETBOX_CONFIGURATION=netbox.configuration_testing python manage.py test ``` In cases where you haven't made any changes to the database (which is most of the time), you can append the `--keepdb` argument to this command to reuse the test database between runs. This cuts down on the time it takes to run the test suite since the database doesn't have to be rebuilt each time. (Note that this argument will cause errors if you've modified any model fields since the previous test run.) From 5f946edb265d02a1ac5a9f232ae0ad7d397078e6 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 22 Mar 2022 11:39:26 -0400 Subject: [PATCH 4/4] Fixes #8919: Fix filtering of VLAN groups by site under prefix edit form --- docs/release-notes/version-3.1.md | 1 + netbox/ipam/forms/models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-3.1.md b/docs/release-notes/version-3.1.md index 6bfd28bca..22c5b0da1 100644 --- a/docs/release-notes/version-3.1.md +++ b/docs/release-notes/version-3.1.md @@ -14,6 +14,7 @@ * [#8813](https://github.com/netbox-community/netbox/issues/8813) - Retain global search bar query after submitting * [#8820](https://github.com/netbox-community/netbox/issues/8820) - Fix navbar background color in dark mode * [#8850](https://github.com/netbox-community/netbox/issues/8850) - Show airflow field on device REST API serializer when config context data is included +* [#8919](https://github.com/netbox-community/netbox/issues/8919) - Fix filtering of VLAN groups by site under prefix edit form * [#8932](https://github.com/netbox-community/netbox/issues/8932) - Fix error when setting null value for interface `rf_role` via REST API * [#8935](https://github.com/netbox-community/netbox/issues/8935) - Correct ordering of next/previous racks to use naturalized names diff --git a/netbox/ipam/forms/models.py b/netbox/ipam/forms/models.py index 08138f4fe..6d51e9bb3 100644 --- a/netbox/ipam/forms/models.py +++ b/netbox/ipam/forms/models.py @@ -222,7 +222,7 @@ class PrefixForm(TenancyForm, CustomFieldModelForm): label='VLAN group', null_option='None', query_params={ - 'site_id': '$site' + 'site': '$site' }, initial_params={ 'vlans': '$vlan'