Answer the question
In order to leave comments, you need to log in
How to display data in a given time range?
Sort movies by number of comments
topMovie = Movie.objects.annotate(
num_comments=Count('Comments')).order_by('-num_comments')
topMovie = Movie.objects.annotate(
num_comments=Count('Comments')).order_by('-num_comments')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question