Fix: Interface "Create & Add Another" does not pre-populate previous values (#22656) (#22680)

This commit is contained in:
Sri Chandraja Reddy Allala 2026-07-14 17:25:43 -04:00 committed by GitHub
parent c1d8ff1216
commit 5198a640eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 3 deletions

View File

@ -603,10 +603,16 @@ class ComponentCreateView(GetReturnURLMixin, BaseObjectView):
))
# Redirect user on success
if '_addanother' in request.POST and safe_for_redirect(request.get_full_path()):
return redirect(request.get_full_path())
if '_addanother' in request.POST:
redirect_url = request.path
params = prepare_cloned_fields(new_objs[-1])
if 'return_url' in request.GET:
params['return_url'] = request.GET.get('return_url')
if params:
redirect_url += f"?{params.urlencode()}"
if safe_for_redirect(redirect_url):
return redirect(redirect_url)
return redirect(self.get_return_url(request))
except (AbortRequest, PermissionsViolation) as e:
logger.debug(e.message)
form.add_error(None, e.message)