I'm trying to do something similar to this, in Django. This is part of the page of Anna:
Pos NickName Points
--- --------- ------
1 The best 1000
...
35 Roger 550
36 Anna 545
37 Paul 540
It's a chart showing the scoring system, and it intends to show the first position, as well as the relative position of the presented player.
Showing the first one it's easy, as it's only making a query to the database and extracting the first one:
best = Score.objects.all().order_by('-points')[0]
But I'm having problems getting the ones close to the presented player (Anna, in this case). I don't want to go searching through the complete list, as the complete list of players can be quite long.
Maybe there's a way to know the position a register occupies in an ordered list...
Any ideas on how to achieve it?