class CustomGalleryDetailView(DetailView):

    def get_queryset(self):
        if not self.request.user.is_authenticated():
            qs = Gallery.objects.on_site().is_public()
AssertionError Cannot filter a query once a slice has been taken