Pivoting data and complex annotations in Django ORM
问题 The ORM in Django lets us easily annotate (add fields to) querysets based on related data, hwoever I can't find a way to get multiple annotations for different filtered subsets of related data. This is being asked in relation to django-helpdesk, an open-source Django-powered trouble-ticket tracker. I need to have data pivoted like this for charting and reporting purposes Consider these models: CHOICE_LIST = ( ('open', 'Open'), ('closed', 'Closed'), ) class Queue(models.model): name = models