1
I’m making a site of a game using Jango and I want to make a ranking based on the score of all users! For now it’s like this:
py views.:
def index(request):
perfis = Perfil.objects.all().order_by('-pontuacao_ultima')
return render(request, 'index.html', {'perfis' : perfis})
index.html:
{% for perfis in perfis %}
<tr>
<td>1</td>
<td>{{ perfis.nome }}</td>
<td>{{ perfis.pontuacao_ultima }} pontos</td>
</tr>
{% endfor %}
In the case it is already ordering, but I am doubtful what to do to the position number vary according to the actual position of the player (first, second, etc.). For now it is showing only the 1 (manually put in html).