From a16564f9fcadb06f749a2d02fbf1cf2ad9f79fd3 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Tue, 30 Apr 2024 08:29:19 -0500 Subject: [PATCH] Fix saving cable which results in resetting of the termination type fields --- netbox/dcim/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index a2e9ef12a..eb81e99c5 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -3189,9 +3189,11 @@ class CableEditView(generic.ObjectEditView): # If creating a new Cable, initialize the form class using URL query params if 'pk' not in kwargs: + a_terminations_type = request.POST.get('a_terminations_type') or request.GET.get('a_terminations_type') + b_terminations_type = request.POST.get('b_terminations_type') or request.GET.get('b_terminations_type') self.form = forms.get_cable_form( - a_type=CABLE_TERMINATION_TYPES.get(request.GET.get('a_terminations_type')), - b_type=CABLE_TERMINATION_TYPES.get(request.GET.get('b_terminations_type')) + a_type=CABLE_TERMINATION_TYPES.get(a_terminations_type), + b_type=CABLE_TERMINATION_TYPES.get(b_terminations_type) ) return super().dispatch(request, *args, **kwargs)