Let\'s say I have the following model:
class Contest: title = models.CharField( max_length = 200 ) description = models.TextField() class Image:
You can write your own sort in Python very simply.
def getScore( anObject ): return anObject.score() objects= list(Contest.objects.get( pk = id ).image_set) objects.sort( key=getScore )
This works nicely because we sorted the list, which we're going to provide to the template.