import logging from incident.models import Incident from networkmap.api import DANGER_STATUSES _log = logging.getLogger() def get_opened_incidents_count(): return Incident.objects.filter(status__in=DANGER_STATUSES).distinct().count()