I keep getting this error ('function' object is not iterable) after having added a new def function in my .views file, any thoughts on what the problem could be?
The goal with this is to filter querysets with checkboxes.
Here's my views.py function:
def FilterView(request):
qs = Product.objects.all()
ptag = request.GET.get('ptag')
if ptag == 'on':
qs = qs.filter(ptag='')
qs = filter(request)
context = {
'queryset': qs
}
return render(request, "partials/search_form.html", context)
And in my urls:
from search.views import HomeView, FilterView
urlpatterns = [
url(r'^$', HomeView.as_view(), FilterView),
]
Thanks so much!
qs = filter(request)supposed to do?url(...)inurlpatterns? I believepath(...)is recommended.HomeView.as_view()andFilterViewas arguments to your root url?