def apply_filter(self, queryset, name):
    f = self.get_filter(name)
    if (not f.filter_set):
        data = f.get_data(name, self.filter_states)
        if data:
            return f.apply_filter(queryset, data)
    else:
        data_set = f.get_data_set(name, self.filter_states)
        if (len(data_set) > 0):
            return f.apply_filter_set(queryset, data_set)
    return queryset
def apply_filter(self, queryset, name):
    f = self.get_filter(name)
    if (not f.filter_set):
        data = f.get_data(name, self.filter_states)
        if data:
            return f.apply_filter(queryset, data)
    else:
        data_set = f.get_data_set(name, self.filter_states)
        if (len(data_set) > 0):
            return f.apply_filter_set(queryset, data_set)
    return queryset