Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
Calculate the procentage of to values in list Djangotemplate

So i am using Django to show me a list based on some input from the user. i want i to calculate the percentage of how many times the person have been there. so on the first row I want I to find the percentage of 5 out of 5 and the next for 1 out of 5. but right now it is just printing the math..

enter image description here

this is my Django template, where I just put in the math, but how do I make I calculate? do I need to have some javascript or?

{% extends 'base.html'%}
{% block content %}
<h1>list</h1>
<form method="get" action="/attendancecode/showattendance/">
    <p> Class <input type="text" value={{class}} name="class"/></p>
    <p> Subject <input type="text" value={{subject}} name="subject"/></p>
    <p><input type="submit" value="submit" name="submit"/></p>
</form>

    <h2>Students</h2>
    <ul>
        {% for attendance in object_list %}
            <li>{{ attendance.name}} has attended {{ attendance.countAttendance }} out of {{attendance.countLessons}} {{attendance.countAttendance}}/{{attendance.countLessons}}*100 </li>
        {% endfor %}
    </ul>
{% endblock %}

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda