def filter(self, queryset, values):

        query_filters = Q()

        for value in values:

            # split the prefix from the id
            try:
                prefix, sep, caseid = value.rpartition(self.delimiter)
            except __HOLE__:
                prefix = None
                caseid = value


            # if there is a prefix of abc-xyz, then we don't want to
            # try searching in the int field for xyz, presume it's all
            # the prefix, as the suffix MUST always be numeric.
            # also, if the user put the delimiter at the end, strip it off
            if not isinstance(caseid, int) and not caseid.isdecimal():
                prefix = value.rstrip(self.delimiter)
                caseid = None

            kwargs = {}

            if prefix:
                kwargs["{0}__exact".format(self.prefixlookup)] = prefix
            if caseid:
                kwargs["{0}__exact".format(self.lookup)] = caseid

            query_filters = query_filters | Q(**kwargs)

        if values:
            return queryset.filter(query_filters).distinct()

        return queryset
dataset/ETHPy150Open mozilla/moztrap/moztrap/view/lists/cases.py/PrefixIDFilter.filter