-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of GlobalFilter to ModelMultipleChoiceFilter subclass causes crash #102
Comments
@matthewhegarty thanks for investigating, could you confirm it's really a SQLite limitation, and if so, add a note to the related documentation ? Thanks ! |
Yes, I'll confirm when I get a chance to check. |
I tested this using postgres, and there is a different crash:
It looks like this is happening because the generated SQL contains a lookup value which is not quoted correctly (e.g. Elvis Presley): SELECT "albums_album"."id", "albums_album"."name", "albums_album"."rank", "albums_album"."year", "albums_album"."artist_id", "albums_artist"."id", "albums_artist"."name"
FROM "albums_album"
INNER JOIN "albums_artist" ON ("albums_album"."artist_id" = "albums_artist"."id")
WHERE "albums_artist"."name"::text ~ Elvis Presley ORDER BY "albums_album"."rank" ASC Declaring artist_name = YADCFModelMultipleChoiceFilter(
field_name="artist__name", queryset=Artist.objects.all(), lookup_expr="contains", to_field_name="name"
) |
I tried to update the example application to include global search support for the YADCF column filters.
i.e. in example/album/views.py:
However, the inclusion of
GlobalFilter
inYADCFModelMultipleChoiceFilter
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
This will cause the application to crash with:
I suspect that this might be due to the lack of regexp support in sqlite by default.
st1.txt
The text was updated successfully, but these errors were encountered: