How to show row numbers in django admin listview using the front-end

I wanted to show row number in django admin listview as in the image

enter image description here

tried doing it in the admin.py with the following code in different ModelAdmins:

     indexCnt = 0
     def index_counter(self, obj):
         count = Basic_inspection.objects.all().count()
         if self.indexCnt < count:                                                     
            self.indexCnt += 1
         else:
             self.indexCnt = 1
         return self.indexCnt

But there are problems with this approach, it gets disordered when changing the list page, changing the "sort by" or even when multiple requests to the site.

How can I show row numbers in listview using the templates?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum