[Fixed]-Trying to get Count('foo__bar') inside annotate()

1👍

I think you’ve got that relationship the wrong way round, haven’t you? Artist doesn’t have any kind of direct relationship to Votes, it only does to Works. The annotate call should be to Count('work__votes').

(Also note that normal naming convention for Django is to use singular names: Vote, Work, Artist.)

Leave a comment