Don't render twice on HTMX requests

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

View File

@ -45,6 +45,8 @@ $(document).ready(function(){
"msg_id": "off",
"net_id": "off",
"user_id": "off",
"nick_id": "off",
"status": "off",
"num_users": "off",
"num_chans": "off",
"exemption": "off",

View File

@ -211,14 +211,16 @@ def drilldown_search(request, return_context=False, template=None):
context["class"] = "warning"
# unique = str(uuid.uuid4())[:8]
if return_context:
return 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
if return_context:
return context
return response