Add the unique variable sooner to the Drilldown context

This commit is contained in:
Mark Veidemanis 2022-09-02 07:20:30 +01:00
parent 0ccde2af1b
commit 79a8e5f6e4
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
3 changed files with 4 additions and 6 deletions

View File

@ -363,9 +363,7 @@ def query_results(
sources = [source]
else:
sources = settings.OPENSEARCH_MAIN_SOURCES
print("SOURCES", sources)
if request.user.has_perm("core.restricted_sources"):
print("HAS PERM")
for source_iter in settings.OPENSEARCH_SOURCES_RESTRICTED:
sources.append(source_iter)

View File

@ -50,5 +50,5 @@
{% block custom_script %}
grid.removeWidget("drilldown-widget-results");
grid.removeWidget("drilldown-widget-{{ unique }}");
{% endblock %}

View File

@ -117,7 +117,7 @@ def drilldown_search(request, return_context=False, template=None):
query_params = request.POST.dict()
else:
template_name = "ui/drilldown/drilldown.html"
context = {"sizes": sizes}
context = {"sizes": sizes, "unique": "results"}
return render(request, template_name, context)
tmp_post = request.POST.dict()
@ -166,6 +166,7 @@ def drilldown_search(request, return_context=False, template=None):
extra_params["tags"] = tags
context = query_results(request, query_params, **extra_params)
context["unique"] = "results"
# Valid sizes
context["sizes"] = sizes
@ -206,8 +207,6 @@ def drilldown_search(request, return_context=False, template=None):
context["class"] = "warning"
# unique = str(uuid.uuid4())[:8]
context["unique"] = "results"
context["widget_options"] = ""
response = render(request, template_name, context)
if request.GET:
@ -259,6 +258,7 @@ class DrilldownTableView(SingleTableView):
if k not in context:
context[k] = v
context["show"] = show
if request.method == "GET":
if not request.htmx:
self.template_name = "ui/drilldown/drilldown.html"