how to show the rank based on a field value in django Templates?

Viewed 201

I have a list of details which contain total score. i want to show the rank based on the total score. if the scores are equal the rank must be same. how to do it? thanks in advance.

{% for rank in ranking %}
                                      {% with forloop.counter as count %}
                                          <tr>
                                              <td>{% if rank.name  %} {{rank.name}} {% endif %}</td>
                                              <td>{{count}}</td> 
                                              <td>{% if rank.total_score %}{{rank.total_score}}%{% else %} {% trans '0%' %}{% endif %}</td>
                                          </tr>
                                      {% endwith %}
                              {% endfor %}
0 Answers
Related