django - Boosting one queryset over another queryset -


we doing search in django , have 2 query sets: 1 and queryset , 1 or queryset.

q_list = [q(x) x in predicates if x[1]] _filter_and = reduce(operator.and_, q_list) _filter_or = reduce(operator.or_, q_list) _queryset_and = queryset.filter(_filter_and) _queryset_or = queryset.filter(_filter_or).exclude(id__in=[c.id c in _queryset_and]) queryset = list(chain(_queryset_and, _queryset_or))  

now, when returning, data data mixed. also, want have results and queryset appear first.

would know how in django? in advance!


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -