Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
targets = (
    User.objects
    .annotate(
        match_count=Count("targets__matches_1") + Count("targets__matches_2")
    ).order_by("-match_count")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment