def get_queryset(self, base_qs=None):
        qs = self.model.objects.all() if base_qs is None else base_qs
        # enforce ordering so later use of distinct() works as expected.
        if not qs.query.order_by:
            if self.order_by is None:
                qs = qs.order_by('pk')
            else:
                qs = qs.order_by(*self.order_by)
        if self.qs_filter:
            qs = qs.filter(self.qs_filter)
        return qs
Return a filtered, ordered queryset for this collection.
dataset/ETHPy150Open django-ddp/django-ddp/dddp/api.py/Collection.get_queryset