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

243
Vistas
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 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