Hello. Site search works only case sensitive. How can I fix it? Search code:
class SearchResultsView(ArticlesView): def get_queryset(self, request): if request.POST.has_key('search'): return self.model.objects.filter( Q(title__icontains=request.POST['search']) | Q(content__icontains=request.POST['search']) ).distinct() return [] def post(self, request): self.object_list = self.get_queryset(request) context = self.get_context_data(object_list=self.object_list) return self.render_to_response(context) Help me please)
icontainsdoesn’t work as expected, but I’ll say that you don’t need to use aPOSTrequest in the search, useGET, the first one is needed only when you want to change the data in the database. - Ivan Semochkin