view rendering weekdays

Hi,
I am new user of Django.
I have a model.py.

class Clase(models.Model):
    DAYS_OF_THE_WEEK={
        "7": "MON",
        "1": "TUE",
        "2": "WED",
        "3": "THU",
        "4": "FRI",
        "5": "SAT",
        "6": "SUN",
    }
    name=models.CharField(max_length=30)  
    day=models.CharField(max_length = 20,choices = DAYS_OF_THE_WEEK,default = 'MON')

and a Class view to list the Class objects:

class list_clases(LoginRequiredMixin,ListView):
    model=Clase
    fields=['name','day']
    template_name='website/listar_clases.html'
    success_url=reverse_lazy('clase')

and the template:

<table class = "table table-bordered">
    <thead>
            <tr>
                    <th id="clase">CLASE</th>
                    <th id="clase">DIA DE CLASE</th>
                    <th id="opciones">Acciones</th>
                    </tr>
                    <tr>
                {% for clase in object_list %}
                    <td> {{ clase.name }} </td>
                    <td> {{ clase.day}} </td>
                    <td> <a class="btn btn-primary" href="{% url 'reservar' clase.id %}">BOOK</a> </td>
                </tr>
                {% endfor %}  
    </thead

The problem is that I would like to show the weekday as ‘Monday’, ‘Tuesday’, etc… but the filter
|date:‘l’ for {{clase.day|date:‘l’ }} is not working. The Model, view and template work fine showing the weekday numbers if I remove the filter. I wonder if the problem could be that clase.day is considered as string, and tried the conversion to integer using {{clase.day|to_int}} but it gives an error (Invalid filter: ‘to_int’)

Any suggestion to show the weekdays in the template?
Thank you

Side note: When posting code consisting of multiple lines, you need to surround that code by lines of three backtick characters. Those lines of ``` must be lines by themselves and not part of the lines containing code. (I took the liberty of fixing your post for you.)

In the template you could use the magic Model.get_FOO_display() method (in the docs. So in your case:

    <td> {{ clase.get_day_display }} </td>

However, that will only render the text label of the choice which for your field is “MON”, “TUE”, etc. You could change those labels in the model to “Monday” etc.

Excellent, this is what I was looking for. I applied it on my template after I changed the form.
Thank you!