Add defaults to context and pass them before they are removed

This commit is contained in:
Mark Veidemanis 2022-09-05 07:20:30 +01:00
parent 11dbe3e094
commit 667e4c475f
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 6 additions and 5 deletions

View File

@ -68,9 +68,7 @@ def query_results(
sort = None
query_created = False
source = None
print("BEFORE ADD DEFAULTS", query_params)
helpers.add_defaults(query_params)
print("AFTER ADD DEFAULTS", query_params)
# Check size
if request.user.is_anonymous:
sizes = settings.MANTICORE_MAIN_SIZES_ANON

View File

@ -168,12 +168,15 @@ def drilldown_search(request, return_context=False, template=None):
# Valid sizes
context["sizes"] = sizes
print("BEFORE REMOVE DEFAULT", query_params)
# Add any default parameters to the context
params_with_defaults = dict(query_params)
helpers.add_defaults(params_with_defaults)
context["params"] = params_with_defaults
helpers.remove_defaults(query_params)
print("AFTER REMOVE DEFAULT", query_params)
url_params = urllib.parse.urlencode(query_params)
context["client_uri"] = url_params
context["params"] = query_params
if "message" in context:
if return_context:
return context