def filter_query(self, query):
        """
        Filter the given query using the filter classes specified on the view if any are specified.
        """

        for filter_class in list(self.filter_classes):
            query = filter_class().filter_query(self.request, query, self)

        return query