Browse Source

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

jeremystretch 4 years ago
parent
commit
aaba4b534f

+ 2 - 1
docs/release-notes/version-3.0.md

@@ -14,7 +14,8 @@
 * [#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
 * [#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)
 

+ 3 - 2
netbox/dcim/views.py

@@ -2169,9 +2169,10 @@ class DeviceBayDepopulateView(generic.ObjectEditView):
             removed_device = device_bay.installed_device
             device_bay.installed_device = None
             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', {
             'device_bay': device_bay,

+ 2 - 2
netbox/templates/dcim/devicebay_populate.html

@@ -12,13 +12,13 @@
                 <h5 class="card-header">{% block title %}Populate {{ device_bay }}{% endblock %}</h5>
                 <div class="card-body">
                     <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">
                             <input class="form-control" value="{{ device_bay.device }}" disabled />
                         </div>
                     </div>
                     <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">
                             <input class="form-control" value="{{ device_bay }}" disabled />
                         </div>