Re: Using Unaccent in Model database function

2020-01-05 Thread Alex Scott
I was able to figure this out using... from django.contrib.postgres.lookups import Unaccent queryset.annotate(search_index=StrIndex(Unaccent(Lower('name')), Value(q))) Might be nice to add to the documentation here: https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/lookups/#unaccent O

Using Unaccent in Model database function

2020-01-05 Thread Alex Scott
Hi all, I just started using the Unaccent extension for Postgres and implementing queryset filters with it like: q = 'hello' queryset.filter(name__unaccent__istartswith=q) I'm now trying to annotate the queryset result with the search index: queryset.annotate(search_index=StrIndex(Lower('name'