Fixes #7360: Correct redirection URL after removing child device from device bay

This commit is contained in:
jeremystretch 2021-09-27 09:58:03 -04:00
parent 6d32aa8a88
commit aaba4b534f
3 changed files with 7 additions and 5 deletions

View File

@ -14,7 +14,8 @@
* [#7321](https://github.com/netbox-community/netbox/issues/7321) - Don't overwrite multi-select custom fields during bulk edit * [#7321](https://github.com/netbox-community/netbox/issues/7321) - Don't overwrite multi-select custom fields during bulk edit
* [#7324](https://github.com/netbox-community/netbox/issues/7324) - Fix TypeError exception in web UI when filtering objects using single-choice filters * [#7324](https://github.com/netbox-community/netbox/issues/7324) - Fix TypeError exception in web UI when filtering objects using single-choice filters
* [#7333](https://github.com/netbox-community/netbox/issues/7333) - Prevent inadvertent deletion of prior change records when deleting objects * [#7333](https://github.com/netbox-community/netbox/issues/7333) - Prevent inadvertent deletion of prior change records when deleting objects
* [#7341](https://github.com/netbox-community/netbox/issues/7341) - Fix incorrect url in Circuit breadcrumbs * [#7341](https://github.com/netbox-community/netbox/issues/7341) - Fix incorrect URL in circuit breadcrumbs
* [#7360](https://github.com/netbox-community/netbox/issues/7360) - Correct redirection URL after removing child device from device bay
## v3.0.3 (2021-09-20) ## v3.0.3 (2021-09-20)

View File

@ -2169,9 +2169,10 @@ class DeviceBayDepopulateView(generic.ObjectEditView):
removed_device = device_bay.installed_device removed_device = device_bay.installed_device
device_bay.installed_device = None device_bay.installed_device = None
device_bay.save() device_bay.save()
messages.success(request, "{} has been removed from {}.".format(removed_device, device_bay)) messages.success(request, f"{removed_device} has been removed from {device_bay}.")
return_url = self.get_return_url(request, device_bay.device)
return redirect('dcim:device', pk=device_bay.device.pk) return redirect(return_url)
return render(request, 'dcim/devicebay_depopulate.html', { return render(request, 'dcim/devicebay_depopulate.html', {
'device_bay': device_bay, 'device_bay': device_bay,

View File

@ -12,13 +12,13 @@
<h5 class="card-header">{% block title %}Populate {{ device_bay }}{% endblock %}</h5> <h5 class="card-header">{% block title %}Populate {{ device_bay }}{% endblock %}</h5>
<div class="card-body"> <div class="card-body">
<div class="row mb-3"> <div class="row mb-3">
<label class="col-sm-3 col-form-label">Parent Device</label> <label class="col-sm-3 col-form-label text-lg-end">Parent Device</label>
<div class="col"> <div class="col">
<input class="form-control" value="{{ device_bay.device }}" disabled /> <input class="form-control" value="{{ device_bay.device }}" disabled />
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<label class="col-sm-3 col-form-label">Bay</label> <label class="col-sm-3 col-form-label text-lg-end">Bay</label>
<div class="col"> <div class="col">
<input class="form-control" value="{{ device_bay }}" disabled /> <input class="form-control" value="{{ device_bay }}" disabled />
</div> </div>