From 422c6bad5bc6b1f465e3d86195afc8bc5a5f3125 Mon Sep 17 00:00:00 2001 From: Saria Hajjar Date: Sat, 11 Jan 2020 15:36:58 +0000 Subject: [PATCH 1/3] Fixes #3895: Elevations filter regression --- netbox/dcim/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index f0b91c2f5..e85468445 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -739,7 +739,7 @@ class RackElevationFilterForm(RackFilterForm): # Filter the rack field based on the site and group self.fields['site'].widget.add_filter_for('id', 'site') - self.fields['rack_group_id'].widget.add_filter_for('id', 'group_id') + self.fields['group_id'].widget.add_filter_for('id', 'group_id') # From fe0fbeab49ed345f838a74bd61eef4d265a15d90 Mon Sep 17 00:00:00 2001 From: Saria Hajjar Date: Mon, 13 Jan 2020 12:05:06 +0000 Subject: [PATCH 2/3] Fixes #3902: relax non-essential required fields --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/forms.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 88cd9c120..c83fc8173 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -15,6 +15,7 @@ * [#3668](https://github.com/netbox-community/netbox/issues/3668) - Search by DNS name when assigning IP address * [#3851](https://github.com/netbox-community/netbox/issues/3851) - Allow passing initial data to custom script forms * [#3891](https://github.com/netbox-community/netbox/issues/3891) - Add `local_context_data` filter for virtual machines +* [#3902](https://github.com/netbox-community/netbox/issues/3902) - Relax the non-essential required fields when connecting cable to circuit or power feed ## Bug Fixes diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index f0b91c2f5..14c997b30 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -2804,6 +2804,7 @@ class ConnectCableToCircuitTerminationForm(BootstrapMixin, ChainedFieldsMixin, f termination_b_provider = forms.ModelChoiceField( queryset=Provider.objects.all(), label='Provider', + required=False, widget=APISelect( api_url='/api/circuits/providers/', filter_for={ @@ -2857,6 +2858,7 @@ class ConnectCableToPowerFeedForm(BootstrapMixin, ChainedFieldsMixin, forms.Mode termination_b_site = forms.ModelChoiceField( queryset=Site.objects.all(), label='Site', + required=False, widget=APISelect( api_url='/api/dcim/sites/', display_field='cid', @@ -2888,6 +2890,7 @@ class ConnectCableToPowerFeedForm(BootstrapMixin, ChainedFieldsMixin, forms.Mode ('rack_group', 'termination_b_rackgroup'), ), label='Power Panel', + required=False, widget=APISelect( api_url='/api/dcim/power-panels/', filter_for={ From 32ffc1b54b128260e627659a7816dfd13ca80e1c Mon Sep 17 00:00:00 2001 From: Saria Hajjar Date: Mon, 13 Jan 2020 15:31:35 +0000 Subject: [PATCH 3/3] Fixes #3905: divide by zero on power feeds with low values --- docs/release-notes/version-2.6.md | 1 + netbox/templates/dcim/powerfeed.html | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 88cd9c120..cffaa1a41 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -28,6 +28,7 @@ * [#3872](https://github.com/netbox-community/netbox/issues/3872) - Paginate related IPs of an address * [#3876](https://github.com/netbox-community/netbox/issues/3876) - Fixed min/max to ASN input field at the site creation page * [#3882](https://github.com/netbox-community/netbox/issues/3882) - Fix filtering of devices by rack group +* [#3905](https://github.com/netbox-community/netbox/issues/3905) - Fix divide-by-zero on power feeds with low power values --- diff --git a/netbox/templates/dcim/powerfeed.html b/netbox/templates/dcim/powerfeed.html index a8ab302eb..4e88f09c9 100644 --- a/netbox/templates/dcim/powerfeed.html +++ b/netbox/templates/dcim/powerfeed.html @@ -112,7 +112,9 @@ {% if utilization %} {{ utilization.allocated }}VA / {{ powerfeed.available_power }}VA - {% utilization_graph utilization.allocated|percentage:powerfeed.available_power %} + {% if powerfeed.available_power > 0 %} + {% utilization_graph utilization.allocated|percentage:powerfeed.available_power %} + {% endif %} {% else %} N/A