def handle_many(self):
        query = Check.objects.filter(user__isnull=False).select_related("user")

        now = timezone.now()
        going_down = query.filter(alert_after__lt=now, status="up")
        going_up = query.filter(alert_after__gt=now, status="down")
        # Don't combine this in one query so Postgres can query using index:
        checks = list(going_down.iterator()) + list(going_up.iterator())
        if not checks:
            return False

        futures = [executor.submit(self.handle_one, check) for check in checks]
        for future in futures:
            future.result()

        return True
Returns active instances of ActivatorModel: SomeModel.objects.active()
dataset/ETHPy150Open healthchecks/healthchecks/hc/api/management/commands/sendalerts.py/Command.handle_many--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/mongodb/models.py/ActivatorModelManager.active