[Solved]-Django QuerySet object has no attribute 'objects

24👍

You should change

products = products.objects.filter(category=category)

to

products = products.filter(category=category)

In short, you’ve already queried data at the objects level, thus the .objects identifier is no longer necessary or valid at this point in the code.

You can find more info here.

Leave a comment