I have to sort queryset by occurrence of elements from list in two fields. Currently I wrote part that find objects:
self.filter((reduce(operator.or_, ((Q(tags__contains=tag) | Q(name__contains=string)) for tag in string.split(' ')))))
but I can't find solution to get right ordering. Ordering by occurence of elements from list, in 'tags' field Would partly solve my issue. But I prefer not to iterate over all objects in queryset..