Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

262
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda