My client is asking something very weird but that makes sense in everyday operations.
I have an user with the first name Nicolás and I am filtering through first name with the value Nicolas.
Is there a way to show up the results? Thanks!
The code I have so far
q = request.GET['q']
q_res = Member.objects.filter(
Q(first_name__icontains = q)|
Q(last_name__icontains = q)
)
You can use unaccent, to make accent insensitive queries. This only works with postgres, and on Django 1.8+ I believe.
If this isn't applicable to you, then you can't do this directly. One potential alternative is to store an unaccented version of the string in a new field and search by that. There's a library for getting the closest possible regular string from a unicode one.