Show text fields CHOICES


I have in my file a field of type CHOICES

VIA = [
    ('1', 'email'),
    ('2', 'Insitu'),
    ('3', 'Telefono'),

class Rec(models.Model):
    id = models.AutoField(primary_key=True)
    estado = models.IntegerField(verbose_name='estado', null=True)
    fecha_reclamacion = models.DateField(null=True,)
    fecha_resolucion = models.DateField(verbose_name='Fecha_resolucion', null=True)
    num_reclamacion = models.CharField(max_length=100, null=True)
    num_cliente = models.CharField(max_length=100, null=True)
    empresa = models.CharField(max_length=100, null=True)
    tipo = models.CharField(max_length=100,null=False,blank=False,choices=TIPO_EMPRESA)
    atiende = models.CharField(max_length=100, null=True,)
    atiende_code = models.IntegerField(verbose_name='Atiende_code', null=True)
    departamento = models.CharField(max_length=100, null=True)
    del_dep_code = models.CharField(max_length=100, null=True)
    via = models.CharField(max_length=100,null=False,blank=False,choices=VIA,default=1)

To save a record the text appears correctly but when saving it already saves with the assigned number.
What I would like is when displaying the records, instead of displaying the assigned number, display the text.

I show the records through a DataTable, I attach part of the code since in this js code I call the different fields of the record

function listadoReclamaciones(){
        url: "/reclamaciones/listado_reclamaciones/",
        dataType: "json",
        success: function(response){
            $('#tabla_reclamaciones tbody').html("");
            for(let i = 0;i < response.length;i++){
                let fila = '<tr>';
                fila += '<td>' + (i +1) + '</td>';
                fila += '<td>' + response[i]["fields"]['num_reclamacion'] + '</td>';
                fila += '<td>' + response[i]["fields"]['via'] + '</td>';
                fila += '<td>' + response[i]["fields"]['fecha_reclamacion'] + '</td>';
                fila += '<td>' + response[i]["fields"]['aprueba'] + '</td>';

My first question would be, is there a specific reason why you’re storing these as numbers? If not, then I would suggest using the strings as the storage values.

If you do (and there are a couple of reasons why you might), then you have a couple different options. But the short answer is that there’s no direct way to do that with your choices defined that way.

See the full discussion at How to properly validate a form with radio buttons for some ideas. [Edit: You can probably start with post #9 in that thread.]


As you comment and according to the thread, for now I will do the formula (‘email’, ‘email’) although these days I will delve into the MEAL_CODES option to have an index of the different options.
Thank you.