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

178
Vistas
How do I change the value of true or false to a text value type it I am checking the row in the entire table Note the table is of type datatables?

use django How do I change the value of true or false to a text value type it I am checking the row in the entire table

name item type items active
item1 15.0 True
item2 15.0 False

change values row active use jquery or django file view.py:

name item type items active
item1 15.0 displayed
item2 15.0 stope

help please

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The most elegant way is likely to specify choices for the BooleanField, so:

from django.db import models

ACTIVE_CHOICES = [
    (False, 'stope')
  , (True, 'displayed')
  ]

class MyModel(models.Model):
    # …
    active = models.BooleanField(choices=ACTIVE_CHOICES)

Then you can render the corresponding label in a template with:

{{ mymodelobject.get_active_display }}

It will also use these choices by default in a ModelForm, ModelAdmin, and serializers.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Without code, it is difficult to give a precise answer.

but the easiest way to set value based on a boolean in javascript is to use a ternary operator.

If true, active will be set to "displayed", if false, active will be set to "stope"

active = boolean_value ? "displayed" : "stope"

about 4 years ago · Juan Pablo Isaza 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