Answer the question
In order to leave comments, you need to log in
How to design such a query in django?
Application in django. There is a table of goods, one of the fields is the manufacturer. You need to get a list of manufacturers whose products appear in the table most often (10 or more times) and sort them by the number of products. It is desirable by means of python without using pure sql.
Answer the question
In order to leave comments, you need to log in
Proizvoditel.objects.anotate(tovar_count=Count('goods')).filter(tovar_count__gte=10).order_by('product_count')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question