Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
Django: icontains over unicode string

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)
    )
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!