Push the URL earlier and don't check for field present
This commit is contained in:
parent
788072f995
commit
a7ee1d531f
|
@ -112,6 +112,12 @@ def drilldown_search(request, return_context=False, template=None):
|
||||||
elif request.POST:
|
elif request.POST:
|
||||||
context = query_results(request, query_params)
|
context = query_results(request, query_params)
|
||||||
|
|
||||||
|
# URI we're passing to the template for linking
|
||||||
|
if "csrfmiddlewaretoken" in query_params:
|
||||||
|
del query_params["csrfmiddlewaretoken"]
|
||||||
|
url_params = urllib.parse.urlencode(query_params)
|
||||||
|
context["client_uri"] = url_params
|
||||||
|
|
||||||
# Turn the query into tags for populating the taglist
|
# Turn the query into tags for populating the taglist
|
||||||
if "query" in query_params:
|
if "query" in query_params:
|
||||||
tags = create_tags(query_params["query"])
|
tags = create_tags(query_params["query"])
|
||||||
|
@ -119,7 +125,13 @@ def drilldown_search(request, return_context=False, template=None):
|
||||||
|
|
||||||
context["params"] = query_params
|
context["params"] = query_params
|
||||||
if "message" in context:
|
if "message" in context:
|
||||||
return render(request, template_name, context)
|
response = render(request, template_name, context)
|
||||||
|
if request.GET:
|
||||||
|
if request.htmx:
|
||||||
|
response["HX-Push"] = reverse("home") + "?" + url_params
|
||||||
|
elif request.POST:
|
||||||
|
response["HX-Push"] = reverse("home") + "?" + url_params
|
||||||
|
return response
|
||||||
|
|
||||||
# Create data for chart.js sentiment graph
|
# Create data for chart.js sentiment graph
|
||||||
graph = make_graph(context["object_list"])
|
graph = make_graph(context["object_list"])
|
||||||
|
@ -129,12 +141,6 @@ def drilldown_search(request, return_context=False, template=None):
|
||||||
context["sizes"] = sizes
|
context["sizes"] = sizes
|
||||||
context = make_table(context)
|
context = make_table(context)
|
||||||
|
|
||||||
# URI we're passing to the template for linking
|
|
||||||
if "csrfmiddlewaretoken" in query_params:
|
|
||||||
del query_params["csrfmiddlewaretoken"]
|
|
||||||
url_params = urllib.parse.urlencode(query_params)
|
|
||||||
context["client_uri"] = url_params
|
|
||||||
|
|
||||||
# URI we're passing to the template for linking, table fields removed
|
# URI we're passing to the template for linking, table fields removed
|
||||||
table_fields = ["page", "sort"]
|
table_fields = ["page", "sort"]
|
||||||
clean_params = {k: v for k, v in query_params.items() if k not in table_fields}
|
clean_params = {k: v for k, v in query_params.items() if k not in table_fields}
|
||||||
|
@ -176,8 +182,8 @@ class DrilldownTableView(SingleTableView):
|
||||||
first = self.object_list[0]
|
first = self.object_list[0]
|
||||||
fields = first.keys()
|
fields = first.keys()
|
||||||
for field in fields:
|
for field in fields:
|
||||||
values_present = all([x[field] is not None for x in self.object_list])
|
# values_present = all([x[field] is not None for x in self.object_list])
|
||||||
if values_present:
|
# if values_present:
|
||||||
if field not in show:
|
if field not in show:
|
||||||
show.append(field)
|
show.append(field)
|
||||||
allow_empty = self.get_allow_empty()
|
allow_empty = self.get_allow_empty()
|
||||||
|
|
Loading…
Reference in New Issue