Properly implement queries

This commit is contained in:
2022-08-03 07:20:30 +01:00
parent 1d2f37f588
commit 6af8e94336
7 changed files with 31 additions and 9 deletions

View File

@@ -245,7 +245,7 @@ class DrilldownContextModal(APIView):
size = 20
# Create the query params from the POST arguments
mandatory = ["net", "channel", "num", "src", "index"]
mandatory = ["net", "channel", "num", "src", "index", "nick"]
invalid = [None, False, "", "None"]
query_params = {k: v for k, v in request.data.items() if v}
for key in query_params:
@@ -258,7 +258,11 @@ class DrilldownContextModal(APIView):
if "mtype" not in query_params:
query_params["mtype"] = None
query_params["sorting"] = "desc"
if query_params["index"] == "int" and query_params["mtype"] == "msg":
if (
query_params["index"] == "int"
and query_params["mtype"] == "msg"
and not query_params["type"] == "query"
):
query_params["index"] = "main"
# Create the query with the context helper
search_query = construct_query(
@@ -292,6 +296,7 @@ class DrilldownContextModal(APIView):
"num": query_params["num"],
"type": query_params["type"],
"mtype": query_params["mtype"],
"nick": query_params["nick"],
}
return render(request, self.template_name, context)