PostgreSQL specific lookupsLink to this heading
UnaccentLink to this heading
The unaccent lookup allows you to perform accent-insensitive lookups using
a dedicated PostgreSQL extension.
This lookup is implemented using Transform, so it
can be chained with other lookup functions. To use it, you need to add
'django.contrib.postgres' in your INSTALLED_APPS and activate
the unaccent extension on PostgreSQL. The
UnaccentExtension migration
operation is available if you want to perform this activation using migrations).
The unaccent lookup can be used on
CharField and TextField:
>>> City.objects.filter(name__unaccent="México")
['<City: Mexico>']
>>> User.objects.filter(first_name__unaccent__startswith="Jerem")
['<User: Jeremy>', '<User: Jérémy>', '<User: Jérémie>', '<User: Jeremie>']