You can override the get_queryset
method inside your ListView.
class BlogList(ListView):
context_object_name = 'blogs'
model = Blog
template_name = 'App_Blog/blog_list.html'
def get_queryset(self):
search = self.request.GET.get('search', '')
blogs = Blog.objects.filter(blog_title__icontains=search)
return blogs
CLICK HERE to find out more related problems solutions.