1 | | UserRoleAccount.objects.filter(pk='24f4a032-3f83-4123-8330-fa60fcbb880c').aggregate( |
2 | | given_count=Sum( |
3 | | Case(When(user_observations_given__group=grp, then=1), |
4 | | output_field=IntegerField()) |
5 | | ), |
6 | | taken_count=Sum( |
7 | | Case(When(user_observations_taken__group=grp, then=1), |
8 | | output_field=IntegerField()) |
9 | | ) |
10 | | ) |
| 1 | UserRoleAccount.objects.annotate(count=Sum(Case(When(user_observations_taken__group=grp,then=1)),default=0,output_field=IntegerField(),distinct=True)).annotate(count1=Sum(Case(When(user_observations_given__group=grp,then=1)),default=0,output_field=IntegerField(),distinct=True)) |