Replace query postprocessing with a QuerySet annotation.

Simple refactor for this little bit of logic.