Django’s general policy is that templates should be kept as simple as possible. It's possible to create range() objects in the view, place them in the context, and then iterate over them in templates.
Also, adding range() for a project is a few lines of code with simple_tag: https://docs.djangoproject.com/en/3.2/howto/custom-template-tags/#simple-tags. So it doesn't seem like much to ask users to add it when required. On Sat, 2 Oct 2021 at 12:24, Dhruva Shaw <dhruvas...@gmail.com> wrote: > I did read this comment > https://code.djangoproject.com/ticket/13088#comment:1 and it says its > more like adding programming to templates! :( > > Isn't whole template a programming (made up of programming blocks)?? I > mean there is a for loop and all , also there are some cases where you need > a numeric iterator for which the the no items for the loop is directly > coming from database eg > https://github.com/Tanzanite-lpu/tgl-2.0.0/blob/ddce5ef87a4b5248b8cb8cd5fa3df4adb3f00b31/main/templates/groups.html#L36 > > Also there maybe a case where you want to run a loop without a list. > > So I believe a range function should be added. :) > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/dababcf6-3693-40cd-8c5c-5873592ed7c5n%40googlegroups.com > <https://groups.google.com/d/msgid/django-developers/dababcf6-3693-40cd-8c5c-5873592ed7c5n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM0cZL-9%3Dc932iEBvf1zzEEUV58aGZpGcxSHDq7ue39C-w%40mail.gmail.com.