Let\'s say I have the following model:
class Contest: title = models.CharField( max_length = 200 ) description = models.TextField() class Image:
The db-level order_by cannot sort queryset by model's python method.
order_by
The solution is to introduce score field to Image model and recalculate it on every Vote update. Some sort of denormalization. When you will can to sort by it.
score
Image
Vote