These are chat archives for django/django

7th
Jun 2015
Ramaseshan
@ramaseshan
Jun 07 2015 16:03

How would I contruct a query like this :
Input parameters [a,b,c]
Processing of the input [[a,b,c],[a,b],[b,c],[c,a],[a],[b],[c]]

Field : test = models.ManytoManyField(anothermodel)

I want to construct a query

  1. That will pick all the fileds in test ,matching one or more of the input parametrs.
  2. Ordered by the most matching data first and the lest matching data last !! Like the order being matching all [a,b,c] first and [a,b] [b,c] etc next and then a or b or c last !!

Any inputs ?