Convert column name to filter.

def pw_converter(handler, flt):
    """Convert column name to filter."""
    import peewee as pw

    if isinstance(flt, Filter):
        return flt

    model = handler.model
    field = getattr(model, flt)

    if isinstance(field, pw.BooleanField):
        return PWBoolFilter(flt)

    if field.choices:
        choices = [(Filter.default, '---')] + list(field.choices)
        return PWChoiceFilter(flt, choices=choices)

    return PWFilter(flt)