How can I implement polling the table and keep the filter applied to it? [Django-filter] [HTMX]

I need to filter my database while live updating it too. However, the current rendering doubles the form and resets the filter to show all the data. How can I filter my data and update it at the same time

filter my data and update it at the same time

import django_filters
from django_filters import DateFilter
from .models import CheckingStatus, Participant
from django.db.models import Q

class ParticipantFilter(django_filters.FilterSet):
    class Meta:
        model = Participant
        fields = '__all__'

def display_view(request):
    myFilter = ParticipantFilter(request.GET, queryset=Participant.objects.all())
    data = myFilter.qs
    return render(request, 'display.html', {'data': data, 'myFilter': myFilter})


          <form method ="get">
            <button class "btn btn-primary" type = "Submit"></button>

    <div id="table-results" hx-get="/display" hx-trigger="every 2s">

     <table border="1" class="table table-dark table-hover">
             <th>Checking Status</th>
         {% for k in data  %}
         {% endfor %}

Thanks for your time

Back to Top