Column filtering with multiple values

Issue #73 new
Anil kumar created an issue

Hi,

Currently, the package supports the only column with a single value for filtering data what if we want to filter a column with multiple values with an OR condition. I have written this by overriding the filter_queryset method it works perfectly but, it would be better if we add this in a package.

This is the code which I have written in filter_queryset:

# column specific filter
if col['search.value']:
    qsplit = col['search.value'].split('|')
    or_query = None
    for term in qsplit:
        qc = Q(**{"%s__icontains" % column: term})
        if or_query is None:
            or_query = qc
        else:
            or_query = or_query | qc
    qs = qs.filter(or_query)

Comments (0)

  1. Log in to comment