Skip to content

querysets

django_spire.metric.visual.querysets

VisualQuerySet

Bases: HistoryQuerySet, SearchQuerySetMixin

bulk_filter

Source code in django_spire/metric/visual/querysets.py
def bulk_filter(self, filter_data: dict) -> QuerySet[Visual]:
    queryset = self

    search = filter_data.get('search', '')
    if search:
        queryset = queryset.search(search)

    return queryset

with_statistic

Source code in django_spire/metric/visual/querysets.py
def with_statistic(self) -> QuerySet[Visual]:
    return self.select_related('statistic')

with_conditions

Source code in django_spire/metric/visual/querysets.py
def with_conditions(self) -> QuerySet[Visual]:
    return self.prefetch_related('conditions')

of_kind

Source code in django_spire/metric/visual/querysets.py
def of_kind(self, kind: str) -> QuerySet[Visual]:
    return self.filter(kind=kind)

indicators

Source code in django_spire/metric/visual/querysets.py
def indicators(self) -> QuerySet[Visual]:
    return self.of_kind(VisualKindChoices.INDICATOR)

charts

Source code in django_spire/metric/visual/querysets.py
def charts(self) -> QuerySet[Visual]:
    return self.exclude(kind=VisualKindChoices.INDICATOR)

VisualConditionQuerySet

Bases: HistoryQuerySet

for_visual

Source code in django_spire/metric/visual/querysets.py
def for_visual(self, visual: Visual) -> QuerySet:
    return self.filter(visual=visual)