the query set will return all published posts with the most comments.
However, the problem is that it counts inactive comments (active=False) as well. It should not do that because we might have a comment with inappropriate content and we don't want to count that as a comment to show to the users.
the second issue is that we don't have to display posts with no comments. but the query set above will show posts with no comments too.
this approach has 2 problems:
the query set will return all published posts with the most comments. However, the problem is that it counts inactive comments (active=False) as well. It should not do that because we might have a comment with inappropriate content and we don't want to count that as a comment to show to the users.
the second issue is that we don't have to display posts with no comments. but the query set above will show posts with no comments too.
here is my solution:
This function retrieves most commented posts, where the comments are active.