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

292
Vistas
How to check if a Django arrayfield has data

I have a Django model for articles with an array field that sometimes has ids.

id_list = ArrayField(models.CharField(max_length=10000), blank=True, null=True)

I want to write a query that finds all the article objects that have data in the id_list. I tried the following, but it did not work.

Article.objects.filter(id_list__isnull=False)

What is the correct way to write this? Thank you.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use the len filter on an ArrayField and filter where the length of the array is greater than 0

Article.objects.filter(id_list__len__gt=0)
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