I need to get all books which title contain all ‘parts’ from the variable-length list.
Like (not working):
title_list = ['tree', 'sun']
books = Books.objects.filter(title__icontains=title_list)
or in SQL (working):
SELECT * FROM `books` WHERE title LIKE '%tree%' AND title LIKE '%sun%';
How can I do this?
This appears to work: