Django - Dynamic filters in a webpage

Hi everyone, I am still a learner for python django. I’d like to filter dynamically data on the table below

The informations in my html template are :

                <th>Date commande</th>
        {% for item in query_results %}
                <td>{{ item.numero_commande }}</td>
                <td>{{ item.enseigne}}</td>
                <td>{{ item.Objet}}</td>
                <td>{{ item.Date_commande}}</td>
                <td>{{ item.Montant}}</td>
                <td>{{ item.Etat}}</td>

Here is an exemple of what I’d like to have (filters on table fields) :

thank you in advance for your help


  1. Create a form with your filter fields
  2. Build a dictionary from the submitted form with keys and values from the form data for those fields containing data
  3. Build a query passing that dictionary in as the keyword arguments for the filter.
1 Like

You could also take a look at this package :slight_smile: