Fix saving cable which results in resetting of the termination type fields

This commit is contained in:
Daniel Sheppard 2024-04-30 08:29:19 -05:00
parent 297ab4a9db
commit a16564f9fc

View File

@ -3189,9 +3189,11 @@ class CableEditView(generic.ObjectEditView):
# If creating a new Cable, initialize the form class using URL query params # If creating a new Cable, initialize the form class using URL query params
if 'pk' not in kwargs: 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( self.form = forms.get_cable_form(
a_type=CABLE_TERMINATION_TYPES.get(request.GET.get('a_terminations_type')), a_type=CABLE_TERMINATION_TYPES.get(a_terminations_type),
b_type=CABLE_TERMINATION_TYPES.get(request.GET.get('b_terminations_type')) b_type=CABLE_TERMINATION_TYPES.get(b_terminations_type)
) )
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)