1class ProfileList(ListView):
2 template_name = 'your_template.html'
3 model = Profile
4
5 def get_queryset(self):
6 query = self.request.GET.get('q')
7 if query:
8 object_list = self.model.objects.filter(name__icontains=query)
9 else:
10 object_list = self.model.objects.none()
11 return object_list