[Answer]-Django sum of model objects and model field for related model as list

1👍

I would define my own sort method:

def article_sort(article_object):
     return len(article_object.foos.all()) + article_object.bar.peaces

def view():
    articles = sorted(Article.objects.all(), key=article_sort)

More information here

Leave a comment