HX-Replace URLs instead of pushing

This commit is contained in:
Mark Veidemanis 2023-02-09 23:38:12 +00:00
parent cb9500a36d
commit 29e57628e4
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@
</thead> </thead>
{% for item in object_list %} {% for item in object_list %}
<tr> <tr>
<td><a href="/search/?rule={{ item.id }}&query=*&source=all">{{ item.id }}</a></td> <td><a href="/?query=*&source=all&rule={{ item.id }}">{{ item.id }}</a></td>
<td>{{ item.user }}</td> <td>{{ item.user }}</td>
<td>{{ item.name }}</td> <td>{{ item.name }}</td>
<td>{{ item.interval }}s</td> <td>{{ item.interval }}s</td>

View File

@ -209,9 +209,9 @@ class DrilldownTableView(SingleTableView):
# Still push the URL so they can share it to get assistance # Still push the URL so they can share it to get assistance
if request.GET: if request.GET:
if request.htmx: if request.htmx:
response["HX-Push"] = reverse("home") + "?" + url_params response["HX-Replace"] = reverse("home") + "?" + url_params
elif request.POST: elif request.POST:
response["HX-Push"] = reverse("home") + "?" + url_params response["HX-Replace"] = reverse("home") + "?" + url_params
return response return response
# Create data for chart.js sentiment graph # Create data for chart.js sentiment graph
@ -265,7 +265,7 @@ class DrilldownTableView(SingleTableView):
response = self.render_to_response(context) response = self.render_to_response(context)
# if not request.method == "GET": # if not request.method == "GET":
if "client_uri" in context: if "client_uri" in context:
response["HX-Push"] = reverse("home") + "?" + context["client_uri"] response["HX-Replace"] = reverse("home") + "?" + context["client_uri"]
return response return response
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):