I made this table but I can't figure out how to do the numbering. I want a top 10 list and I get all the data from a database. I essentially want to make it show '1' and the next '2' and the next '3' and so forth. How would I able to do this?
def home(request): straatData = data.objects.all()[:10]
count = data.objects.count() numbers = []for dataCount in range(1, count + 1):
numbers.append(dataCount)context = {
‘data’: straatData,
‘count’: numbers,
}return render(request, ‘home.html’, context)
I need to get the top numbers to show 1,2,3,4… as many as the results. But I don’t know how to do it
#python #django