Просмотр исходного кода

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

jeremystretch 4 лет назад
Родитель
Сommit
b95773938d
2 измененных файлов с 3 добавлено и 2 удалено
  1. 1 0
      docs/release-notes/version-3.0.md
  2. 2 2
      netbox/netbox/views/generic.py

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

@@ -4,6 +4,7 @@
 
 
 ### Bug Fixes
 ### 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
 * [#7544](https://github.com/netbox-community/netbox/issues/7544) - Fix multi-value filtering of custom field objects
 
 
 ---
 ---

+ 2 - 2
netbox/netbox/views/generic.py

@@ -282,11 +282,11 @@ class ObjectEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
                 messages.success(request, mark_safe(msg))
                 messages.success(request, mark_safe(msg))
 
 
                 if '_addanother' in request.POST:
                 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 the object has clone_fields, pre-populate a new instance of the form
                     if hasattr(obj, 'clone_fields'):
                     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)
                     return redirect(redirect_url)