Skip to content

Addition of GlobalFilter to ModelMultipleChoiceFilter subclass causes crash #102

@matthewhegarty

Description

@matthewhegarty

I tried to update the example application to include global search support for the YADCF column filters.

i.e. in example/album/views.py:

class YADCFModelMultipleChoiceFilter(GlobalFilter, filters.ModelMultipleChoiceFilter):
    field_class = YADCFModelMultipleChoiceField

class GlobalCharFilter(GlobalFilter, filters.CharFilter):
    pass

class GlobalNumberFilter(GlobalFilter, filters.NumberFilter):
    pass


class AlbumFilter(DatatablesFilterSet):
    artist_name = YADCFModelMultipleChoiceFilter(
        field_name="artist__name", queryset=Artist.objects.all(), lookup_expr="contains"
    )

    rank = GlobalNumberFilter()
    name = GlobalCharFilter()

    class Meta:
        model = Album
        fields = ("artist_name", )

However, the inclusion of GlobalFilter in YADCFModelMultipleChoiceFilter causes the example application to crash.

To reproduce, include the code above (example/albums/views.py), and enter a value into the multi select filter

ex1

This will cause the application to crash with:

sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

I suspect that this might be due to the lack of regexp support in sqlite by default.

st1.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions