code: def get_ordered_entries(self, queryset=False):
          
          if queryset:
              self.queryset = queryset
          else:
              self.queryset = EntryCategory.objects.all()
          if self.queryset:
              for category in self.queryset:
                  entries = category.get_entries()
                  if entries:
                      amount_list = [e.amount_of_views for e in entries]
                      rating_list = [e.rating() for e in entries]
                      views_per_entry = fsum(amount_list) / len(amount_list)
                      rating_per_entry = fsum(rating_list) / len(rating_list)
                      category.last_rank = views_per_entry * rating_per_entry
                      category.save()
                  else:
                      self.queryset = self.queryset.exclude(pk=category.pk)
              self.queryset = sorted(self.queryset, key=lambda c: c.last_rank,
                                     reverse=True)
          return self.queryset
docs: Custom ordering. First we get the average views and rating for
          the categories's entries. Second we created a rank by multiplying
          both. Last, we sort categories by this rank from top to bottom.
  
          Example:
          - Cat_1
              - Entry_1 (500 Views, Rating 2)
              - Entry_2 (200 Views, Rating -4)
              - Entry_3 (100 Views, Rating 3)
          - Cat_2
              - Entry_1 (200 Views, Rating 7)
              - Entry_2 (50 Views, Rating 2)
  
          Result:
          Cat_1 has a rank by: 88.88 (avg. views: 266.66, avg. rating: 0.33)
          Cat_2 has a rank by: 562.5 (avg. views: 125, avg. rating: 4.5)
  
          Cat_2 will be displayed at the top. The algorithm is quality-oriented,
          as you can see.