[Answer]-Returning filter on the same template

1👍

I think you nearly have it.

Instead of adding a new method to the view I think you should override get_queryset:

def get_queryset(self):
    s = Product.objects.all()
    if self.request.GET.get('filter_link', False):
        s = s.filter(stoq__lt=F('stoq_min'))
    return s

and

<p name="filter_link" class="pull-right"><a href="?filter_link=1">Produtos em baixo estoque</a></p>

Leave a comment