[Django]-How to filter query result with some matching letters instead of complete match in python django?

4👍

Use icontains–(Django doc) lookup

def filter_tasks(request: HttpRequest):
    context = {
        'task_list': Task.objects.filter(
            content__icontains=request.POST['content']
        )
    }
    return render(request, 'tasks/task_list.html', context)
👤JPG

Leave a comment