From b95773938d50acdb5404a63c346ca93bee5fdbb9 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 14 Oct 2021 12:24:29 -0400 Subject: [PATCH] Fixes #7534: Avoid exception when utilizing "create and add another" twice in succession --- docs/release-notes/version-3.0.md | 1 + netbox/netbox/views/generic.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index f0bb726d8..4e7d19cdd 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -4,6 +4,7 @@ ### Bug Fixes +* [#7534](https://github.com/netbox-community/netbox/issues/7534) - Avoid exception when utilizing "create and add another" twice in succession * [#7544](https://github.com/netbox-community/netbox/issues/7544) - Fix multi-value filtering of custom field objects --- diff --git a/netbox/netbox/views/generic.py b/netbox/netbox/views/generic.py index 4baf2e0e9..75e978e2a 100644 --- a/netbox/netbox/views/generic.py +++ b/netbox/netbox/views/generic.py @@ -282,11 +282,11 @@ class ObjectEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View): messages.success(request, mark_safe(msg)) if '_addanother' in request.POST: - redirect_url = request.get_full_path() + redirect_url = request.path # If the object has clone_fields, pre-populate a new instance of the form if hasattr(obj, 'clone_fields'): - redirect_url += f"{'&' if '?' in redirect_url else '?'}{prepare_cloned_fields(obj)}" + redirect_url += f"?{prepare_cloned_fields(obj)}" return redirect(redirect_url)