I need something like forloop.counter
in templates.
Is this possible?
Asked
Active
Viewed 139 times
0

farhad bidokhti
- 21
- 8
-
Hi there! forloop.counter is actually made for templates, using django's template language. Is there specific problem you need help with? Reference here: https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#for – Milo Persic Mar 05 '22 at 22:03
-
thanks for you suggestion, but i want use for range loop in admin.py – farhad bidokhti Mar 05 '22 at 22:09
-
Can you describe what you're trying to achieve in the admin with a forloop counter? – Milo Persic Mar 05 '22 at 22:12
-
@MiloPersic I want to have numbering for the rows of my model – farhad bidokhti Mar 05 '22 at 22:38
-
Understood. Does this answer help you? https://stackoverflow.com/questions/62135954/generate-row-numbers-for-django-admin-listview-for-an-app – Milo Persic Mar 06 '22 at 00:15
-
Awesome! Congratulations! – Milo Persic Mar 06 '22 at 14:28