How to create include a Checkbox in a Datatable table in Django

-2

Hello!

I'm with a Boolean field in the table but I did not find in my search anything that would help me change the Boolean by a Checkbox. How do I do that?

Follow my Model.py

class TelefoneCredor(models.Model):
telefone = models.BigIntegerField(primary_key=True)
descricao = models.CharField(max_length=200)
data_cadastro = models.DateTimeField(auto_now=True)
usuario_cadastro = models.CharField(blank=True, max_length=50)
validado_flag = models.BooleanField(default=0)

def __str__(self):
    return self.descricao

Follow my tables.py

from .models import TelefoneCredor
from table import Table
from table.columns import Column, LinkColumn, Link
from table.utils import A


class TelefoneCredorTable(Table):
    telefone = Column(field='telefone', header='Telefone')
    descricao = Column(field='descricao', header='Descrição')
    data_cadastro = Column(field='data_cadastro', header='Data Cadastro')
    usuario_cadastro = Column(field='usuario_cadastro', header='Usuário Cadastro')
    validado_flag = Column(field='validado_flag', header='Validado')


 class Meta:
     model = TelefoneCredor
     ajax = True

My view.py

from .tables import *

def TelefoneCredorList(request):
telefone_credor = TelefoneCredorTable()
return render(request, "app/TelefoneCredorList.html", {'telefone_credor': telefone_credor})

Everything is working, but I want to change the "validado_flag" (Boolean) field to a Checkbox. Acretito that change is in tables.py, but I do not know how to get there.

    
asked by anonymous 05.01.2019 / 17:55

0 answers