Details.objects.all()
Dept Gender Shift
Software Male Day
Software2 Female Night
what i want is json like {"Gender":"Male", "count":2} using queryset. count is the number of male and female in specific dept.
im new to djnago and have tried this
Details.objects.values("Gender").annotate(count=Count("Gender")).order_by("Shift")
where i get
[{'count': 3, 'Gender': u'Female'}, {'count': 1, 'Gender': u'Male'}, {'count': 3, 'Gender': u'Female'}, {'count': 3, 'Gender': u'Male'}]
of both departments...I want one dept at a time(Software/Software2). Please help:) Thanks.
Details.objects.values("Dept", "Gender", "Shift").annotate(count=Count("Gender"))