From b1ec332a5689317495a9e1188cbdc1d14675080a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 6 Aug 2020 13:19:22 -0400 Subject: [PATCH] Fixes #4951: Redirect to device inventory view after creting a new inventory item --- docs/release-notes/version-2.9.md | 1 + netbox/templates/dcim/device.html | 2 +- netbox/utilities/views.py | 4 ---- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 62bc7ac20..ca4a29436 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -20,6 +20,7 @@ * [#4938](https://github.com/netbox-community/netbox/issues/4938) - Show add, import buttons on virtual chassis list view * [#4939](https://github.com/netbox-community/netbox/issues/4939) - Fix linking to LAG interfaces on other VC members * [#4950](https://github.com/netbox-community/netbox/issues/4950) - Include inventory item label in API serializer, UI view +* [#4951](https://github.com/netbox-community/netbox/issues/4951) - Redirect to device inventory view after creting a new inventory item * [#4952](https://github.com/netbox-community/netbox/issues/4952) - Default to VM tab when creating/editing an IP address for a VM ### Other Changes diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index ff3cc71f8..864dddd0c 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -75,7 +75,7 @@
  • Device Bays
  • {% endif %} {% if perms.dcim.add_inventoryitem %} -
  • Inventory Items
  • +
  • Inventory Items
  • {% endif %} diff --git a/netbox/utilities/views.py b/netbox/utilities/views.py index 5f87ed1bf..b472be524 100644 --- a/netbox/utilities/views.py +++ b/netbox/utilities/views.py @@ -1281,10 +1281,6 @@ class ComponentCreateView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View )) if '_addanother' in request.POST: return redirect(request.get_full_path()) - elif 'device_type' in form.cleaned_data: - return redirect(form.cleaned_data['device_type'].get_absolute_url()) - elif 'device' in form.cleaned_data: - return redirect(form.cleaned_data['device'].get_absolute_url()) else: return redirect(self.get_return_url(request))