[Answered ]-How to write Django query to grab all objects in descending order according to two number fields?

1👍

You should order in descending order, you can do this by prefixing the fieldname with a minus (-):

def get_all_top_rated_products(self):
    return self.filter(is_remove=False).order_by(
        '-average_rating', '-total_reviews'
    )

Leave a comment