In order to preserve the order of the words as in the sql LIKE '%pattern%' statement I use iregex, for example:
qs = table.objects.filter(string__iregex=pattern.replace(' ', '.*'))
string methods are immutable so your pattern variable will not change and with .* you'll be looking for 0 or more occurrences of any character but break lines.
By using the following to iterate over the pattern words:
qs = table.objects
for word in pattern.split(' '):
qs = qs.filter(string__icontains=word)
the order of the words in your pattern will not be preserved, for some people that could work but in the case of trying to mimic the sql like statement I'll use the first option.