Skip to content

Commit

Permalink
persist only existing filter ids in session
Browse files Browse the repository at this point in the history
  • Loading branch information
podliashanyk committed Jan 20, 2025
1 parent b1c45b5 commit c9c7b36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/argus/htmx/incident/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ def create_filter(request: HtmxHttpRequest):
@require_GET
def filter_select(request: HtmxHttpRequest):
filter_id = request.GET.get("filter", None)
request.session["selected_filter"] = filter_id
if filter_id and get_object_or_404(Filter, id=filter_id):
request.session["selected_filter"] = filter_id
incident_list_filter = get_filter_function()
filter_form, _ = incident_list_filter(request, None)
context = {"filter_form": filter_form}
return render(request, "htmx/incident/_incident_filterbox.html", context=context)
else:
request.session["selected_filter"] = None
if request.htmx.trigger:
return reswap(HttpResponse(), "none")
else:
Expand Down

0 comments on commit c9c7b36

Please sign in to comment.