1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #7534: Avoid exception when utilizing "create and add another" twice in succession

This commit is contained in:
jeremystretch
2021-10-14 12:24:29 -04:00
parent 6898ae7106
commit b95773938d
2 changed files with 3 additions and 2 deletions

View File

@ -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
---

View File

@ -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)