Categories
How to sort by ManyToManyField field?
How to sort a selection from the database by the number of links in a ManyToManyField type field using standard django tools?
Answer the question
In order to leave comments, you need to log in
.annotate(Count('m2m_field')).order_by('m2m_field__count')
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question