(self)
return queryset.filter(**db_filters).exclude(**db_excludes)
Optionally restricts the queryset by filtering against
        query parameters in the URL.
Optionally restricts the queryset by filtering against
        query parameters in the URL.
Optionally restricts the queryset by filtering against query parameters in the URL .
def get_queryset(self):
        """
        Optionally restricts the queryset by filtering against
        query parameters in the URL.
        """
        query_params = self.request.query_params
        url_params = self.kwargs

        # get queryset_filters from FilterMixin
        queryset_filters = self.get_db_filters(url_params, query_params)

        # This dict will hold filter kwargs to pass in to Django ORM calls.
        db_filters = queryset_filters['db_filters']

        # This dict will hold exclude kwargs to pass in to Django ORM calls.
        db_excludes = queryset_filters['db_excludes']

        # fetch queryset from Players model
        queryset = Player.objects.prefetch_related(
            'teams'  # use prefetch_related to minimize db hits.
        ).all()

        return queryset.filter(**db_filters).exclude(**db_excludes)
def get_queryset ( self ) : query_params = self . request . query_params url_params = self . kwargs # get queryset_filters from FilterMixin queryset_filters = self . get_db_filters ( url_params , query_params ) # This dict will hold filter kwargs to pass in to Django ORM calls. db_filters = queryset_filters [ 'db_filters' ] # This dict will hold exclude kwargs to pass in to Django ORM calls. db_excludes = queryset_filters [ 'db_excludes' ] # fetch queryset from Players model queryset = Player . objects . prefetch_related ( 'teams' # use prefetch_related to minimize db hits. ) . all ( ) return queryset . filter ( * * db_filters ) . exclude ( * * db_excludes )