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

Fixes #8101: Preserve return URL when using "create and add another" button

This commit is contained in:
jeremystretch
2021-12-20 13:41:22 -05:00
parent f95e510060
commit e12da72615
4 changed files with 10 additions and 7 deletions

View File

@ -8,6 +8,7 @@ from typing import Any, Dict, List, Tuple
from django.core.serializers import serialize
from django.db.models import Count, OuterRef, Subquery
from django.db.models.functions import Coalesce
from django.http import QueryDict
from jinja2.sandbox import SandboxedEnvironment
from mptt.models import MPTTModel
@ -249,10 +250,8 @@ def prepare_cloned_fields(instance):
for tag in instance.tags.all():
params.append(('tags', tag.pk))
# Concatenate parameters into a URL query string
param_string = '&'.join([f'{k}={v}' for k, v in params])
return param_string
# Return a QueryDict with the parameters
return QueryDict('&'.join([f'{k}={v}' for k, v in params]), mutable=True)
def shallow_compare_dict(source_dict, destination_dict, exclude=None):