I'm using django-filter to output filtered results of my model. No issues there. Next step is adding a paginator.. though struggling for days now.
views.py:
def funds_overview(request):
f = FundFilter(request.GET, queryset=Fund.objects.all()).qs
paginator = Paginator(f, 5)
page = request.GET.get('page')
funds = paginator.get_page(page)
return render(request, 'funds/funds.html', {'filter': funds})
funds.html:
<form method="get">
<div class="well">
<h4 style="margin-top: 0">Search Criteria</h4>
<div class="row">
<div class="form-group col-sm-4 col-md-3">
{{ filter.form.fund_name.label_tag }}
{% render_field filter.form.fund_name class="form-control" %}
</div>
</div>
<button type="submit" class="btn btn-primary">
<span class="glyphicon glyphicon-search"></span> Search
</button>
{% for fund in filter.qs %}
<p>{{fund.name}} </p>
{% empty %}
No funds match your search criteria
{% endfor %}
Result in the browser The line "no funds match your search criteria" ..
can anyone help? i assume something is wrong with calling the GET request twice?
Thanks !