From 974500c2817719dbd1861d379ede300d54901a65 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 15 Dec 2020 12:01:53 -0500 Subject: [PATCH 1/3] Add test for #5461 --- netbox/dcim/tests/test_views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/netbox/dcim/tests/test_views.py b/netbox/dcim/tests/test_views.py index 97a4f3705..91ec8776c 100644 --- a/netbox/dcim/tests/test_views.py +++ b/netbox/dcim/tests/test_views.py @@ -302,6 +302,14 @@ class RackTestCase(ViewTestCases.PrimaryObjectViewTestCase): 'comments': 'New comments', } + @override_settings(EXEMPT_VIEW_PERMISSIONS=['*']) + def test_list_rack_elevations(self): + """ + Test viewing the list of rack elevations. + """ + response = self.client.get(reverse('dcim:rack_elevation_list')) + self.assertHttpStatus(response, 200) + class ManufacturerTestCase(ViewTestCases.OrganizationalObjectViewTestCase): model = Manufacturer From 14a46f82ee346a8e5edb3a3dc91cee779ceec8a4 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Tue, 15 Dec 2020 12:30:42 -0600 Subject: [PATCH 2/3] Fixes: #5463 - Add check for ip_addresses attribute on circuittermination connected_endpoint --- docs/release-notes/version-2.10.md | 1 + netbox/circuits/views.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.10.md b/docs/release-notes/version-2.10.md index 7584d8eae..771fbbdbc 100644 --- a/docs/release-notes/version-2.10.md +++ b/docs/release-notes/version-2.10.md @@ -6,6 +6,7 @@ * [#5458](https://github.com/netbox-community/netbox/issues/5458) - Creating a component template throws an exception * [#5461](https://github.com/netbox-community/netbox/issues/5461) - Rack Elevations throw reverse match exception +* [#5463](https://github.com/netbox-community/netbox/issues/5463) - Back-to-back Circuit Termination throws AttributeError exception ## v2.10.0 (2020-12-14) diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index 653c881a9..a237b8805 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -139,7 +139,7 @@ class CircuitView(generic.ObjectView): ).filter( circuit=instance, term_side=CircuitTerminationSideChoices.SIDE_A ).first() - if termination_a and termination_a.connected_endpoint: + if termination_a and termination_a.connected_endpoint and hasattr(termination_a.connected_endpoint, 'ip_addresses'): termination_a.ip_addresses = termination_a.connected_endpoint.ip_addresses.restrict(request.user, 'view') # Z-side termination @@ -148,7 +148,7 @@ class CircuitView(generic.ObjectView): ).filter( circuit=instance, term_side=CircuitTerminationSideChoices.SIDE_Z ).first() - if termination_z and termination_z.connected_endpoint: + if termination_z and termination_z.connected_endpoint and hasattr(termination_z.connected_endpoint, 'ip_addresses'): termination_z.ip_addresses = termination_z.connected_endpoint.ip_addresses.restrict(request.user, 'view') return { From 67f9e16905a25eb18b0dd50889d841dadbe88b44 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 15 Dec 2020 13:37:02 -0500 Subject: [PATCH 3/3] Fixes #5453: Correct change log representation when creating a cable --- docs/release-notes/version-2.10.md | 5 ++++- netbox/dcim/models/cables.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.10.md b/docs/release-notes/version-2.10.md index 771fbbdbc..d62646bc4 100644 --- a/docs/release-notes/version-2.10.md +++ b/docs/release-notes/version-2.10.md @@ -1,13 +1,16 @@ # NetBox v2.10 -## v2.10.1 (Future Release) +## v2.10.1 (FUTURE) ### Bug Fixes +* [#5453](https://github.com/netbox-community/netbox/issues/5453) - Correct change log representation when creating a cable * [#5458](https://github.com/netbox-community/netbox/issues/5458) - Creating a component template throws an exception * [#5461](https://github.com/netbox-community/netbox/issues/5461) - Rack Elevations throw reverse match exception * [#5463](https://github.com/netbox-community/netbox/issues/5463) - Back-to-back Circuit Termination throws AttributeError exception +--- + ## v2.10.0 (2020-12-14) **NOTE:** This release completely removes support for embedded graphs. diff --git a/netbox/dcim/models/cables.py b/netbox/dcim/models/cables.py index 7a9f2dc2c..6a530bb49 100644 --- a/netbox/dcim/models/cables.py +++ b/netbox/dcim/models/cables.py @@ -147,7 +147,8 @@ class Cable(ChangeLoggedModel, CustomFieldModel): return instance def __str__(self): - return self.label or '#{}'.format(self._pk) + pk = self.pk or self._pk + return self.label or f'#{pk}' def get_absolute_url(self): return reverse('dcim:cable', args=[self.pk])