Filter a query.

def apply(self, query, data):
        """Filter a query."""
        field = self.model_field or query.model_class._meta.fields.get(self.name)
        if not field or self.name not in data:
            return query
        value = self.value(data)
        if value is self.default:
            return query
        value = field.db_value(value)
        return self.filter_query(query, field, value)