MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / get_queryset

Method get_queryset

apps/channels/api_views.py:602–616  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

600 return [Authenticated()]
601
602 def get_queryset(self):
603 # Annotate both counts at the SQL level so the serializer methods
604 # can read them from the object rather than issuing a COUNT per row.
605 # `distinct=True` is required when multiple reverse-FK annotations
606 # share the same queryset to avoid row-multiplication artifacts.
607 # m3u_accounts is still prefetched for the nested serializer data.
608 return (
609 ChannelGroup.objects
610 .annotate(
611 channel_count=Count('channels', distinct=True),
612 m3u_account_count=Count('m3u_accounts', distinct=True),
613 )
614 .prefetch_related('m3u_accounts')
615 .all()
616 )
617
618 def list(self, request, *args, **kwargs):
619 queryset = self.filter_queryset(self.get_queryset())

Callers 1

listMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected