

def search(self, model, term):
    "\n        Returns the ``Q`` object representing queries to make against this column for the given\n        term.\n\n        It is the responsibility of this method to decide which of this column's sources are\n        database-backed and which are names of instance attributes, properties, or methods.  The\n        ``model`` is provided to identify Django ORM ``ModelField`` s and related models.\n\n        The default implementation resolves each contributing ``source`` from :py:attr:`sources`,\n        and uses :py:meth:`.prep_search_value` to coerce the input search ``term`` to something\n        usable for each of the query :py:attr:`lookup_types` supported by the column.  Any failed\n        coercions will be skipped.\n\n        The default implementation will also discover terms that match the source field's\n        ``choices`` labels, flipping the term to automatically query for the internal choice value.\n        "
    sources = self.get_db_sources(model)
    column_queries = []
    for source in sources:
        handler = self.get_source_handler(model, source)
        for sub_source in self.expand_source(source):
            modelfield = resolve_orm_path(model, sub_source)
            if modelfield.choices:
                for (db_value, label) in modelfield.get_flatchoices():
                    if (term.lower() in label.lower()):
                        k = ('%s__exact' % (sub_source,))
                        column_queries.append(Q(**{
                            k: str(db_value),
                        }))
            lookup_types = handler.get_lookup_types()
            for lookup_type in lookup_types:
                coerced_term = handler.prep_search_value(term, lookup_type)
                if (coerced_term is None):
                    continue
                elif ((lookup_type in ('in', 'range')) and (not isinstance(coerced_term, tuple))):
                    continue
                k = ('%s__%s' % (sub_source, lookup_type))
                lookup_types.append(Q(**{
                    k: coerced_term,
                }))
    if column_queries:
        q = reduce(operator.or_, column_queries)
    else:
        q = None
    return q

dataset/ETHPy150Open pivotal-energy-solutions/django-datatable-view/datatableview/columns.py Column.search/VarMisuse@221/627 `column_queries`->`lookup_types`