mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
fix return proper parent object field
This commit is contained in:
parent
3c972db277
commit
cbcc39d326
@ -3132,12 +3132,24 @@ class CableEditView(generic.ObjectEditView):
|
||||
return obj
|
||||
|
||||
def get_extra_addanother_params(self, request):
|
||||
return {
|
||||
'termination_a_device': resolve(request.GET.get('return_url')).kwargs.get('pk'),
|
||||
|
||||
params = {
|
||||
'a_terminations_type': request.GET.get('a_terminations_type'),
|
||||
'b_terminations_type': request.GET.get('b_terminations_type')
|
||||
}
|
||||
|
||||
pk = resolve(request.GET.get('return_url')).kwargs.get('pk')
|
||||
a_type = CABLE_TERMINATION_TYPES.get(request.GET.get('a_terminations_type'))
|
||||
|
||||
if hasattr(a_type, 'device'):
|
||||
params.update({'termination_a_device': pk})
|
||||
elif hasattr(a_type, 'power_panel'):
|
||||
params.update({'termination_a_powerpanel': pk})
|
||||
elif hasattr(a_type, 'circuit'):
|
||||
params.update({'termination_a_circuit': pk})
|
||||
|
||||
return params
|
||||
|
||||
|
||||
@register_model_view(Cable, 'delete')
|
||||
class CableDeleteView(generic.ObjectDeleteView):
|
||||
|
Loading…
Reference in New Issue
Block a user