Django get data from included html page

I have a website, where on the "search" page I search for a user in a database, on the "results" page, the data appears, and on this site, I want to make a filtering option. I make this with a "filtered.html" page, which is included in the "results.html" and is having checkboxes. I want to get the checkbox value and according to that, filter the "results.html".
If I could get the data from the checkboxes! I don't get any error message, simply nothing shows. (I know that my results page doesn't filter, but I just want it to print my filtered.html data for a start)
results.html

{% extends "base_generic.html" %}
{% block content %}
{% include "filtered.html" %}

{% csrf_token %}

<table>
{% for dictionary in object_list %}
<td><tr>
  {% for key, value in dictionary.items %}
    <td>{{ value }}</td>
  {% endfor %}
</tr></td>
{% endfor %}
</table>

{% endblock %}

filtered.html

<form method="GET" name="FormFilter">

<div class="form-check">
  <input type="checkbox" value="apple" name="fruits"
         checked>
  <label for="scales">apple</label>
</div>

<div class="form-check">
  <input type="checkbox" value="plum" name="fruits"
         checked>
  <label for="scales">plum</label>
</div>

<button type="submit">submit</button>
</form>

view.py

def filter(request):

        fruits = request.GET.getlist('fruits')
        print(fruits)

        if fruits == ['apple']:
            print('you selected apple')
        if fruits == ['plum']:
            print('you selected plum')
        return render(request,'results.html')

I didn't connect the filtered.html in the urls.py site, but I am not sure how to do it or if I have to do it.

Back to Top