Unsupported lookup 'unaccent' for CKEditor5 Field or join on the field not permitted
I am using CKEditor5
for my body field and trying to filter using unaccent
like so
Post.objects.filter(body__unaccent__icontains="text")
but I get the error
Unsupported lookup 'unaccent' for CKEditor5 Field or join on the field not permitted
FYI, I did all the necessary configuration to be sure unaccent
works perfectly. How do I know? I successfully executed
Post.objects.filter(title__unaccent__icontains="text")
where title
is defined with CharField
.
My suggestion is that, unaccent
didn't work for the first case because of CKEditor5
. Is there a way to get this to work with this package?
It looks like you are trying to use the unaccent
function in a CKEditor5
field or in a join clause, but it is not supported.
The unaccent
function is a PostgreSQL
function that removes accent marks from characters in a string, so that characters with and without accent
marks are treated as equivalent. It is often used to improve the performance of full-text search or to handle data that has been input with inconsistent accent marks.
In order to use the unaccent
function in a CKEditor5
field or in a join clause, you will need to make sure that your database is running PostgreSQL
and that the unaccent
extension has been installed and enabled. You can check if the unaccent
extension is installed by running the following command in the psql terminal
:
\dx
This will list all of the installed extensions in your database. If the unaccent
extension is not listed, you can install it by running the following command:
CREATE EXTENSION unaccent;
Once the unaccent extension is installed, you should be able to use the unaccent
function in your CKEditor5
field or join clause.