当前位置: 动力学知识库 > 问答 > 编程问答 >

python - Django Combining __unaccent and __search Lookups

问题描述:

So I am trying to use __unaccent and __search in the same model filter, but I receive an error when doing so. I am trying to make a filter using the term "Pokemon" match the term "Pokémon" (notice the "é")

Game.objects.filter(title__unaccent__icontains="Pokemon") works fine, but when I use Game.objects.filter(title__unaccent__search="Pokemon), I get the following error:

ProgrammingError at /autocomplete-games/ function unaccent(tsquery)

does not exist LINE 1: ...ALESCE(UNACCENT("main_game"."title"), ''))

@@ (UNACCENT(p...

^ HINT: No function matches the given name and argument types. You might need

to add explicit type casts.

I am using:

Python 3.5

Django 1.10

PostgreSQL (unaccent extension installed)

分享给朋友:
您可能感兴趣的文章:
随机阅读: