

class Command(BaseCommand):
    help = 'Calculate officer complaints count'

    def handle(self, *args, **options):
        Allegation.objects.all().update(investigator=None)

        values = Allegation.objects.values('investigator_name')\
            .annotate(dcount=Count('*'))
        for value in values:
            if value['investigator_name']:
                raw_name = value['investigator_name']