Ik range function can be added but I also mentioned that there are some cases range function can't be direct generated from the view like this https://github.com/Tanzanite-lpu/tgl-2.0.0/blob/ddce5ef87a4b5248b8cb8cd5fa3df4adb3f00b31/main/templates/groups.html#L36
Well I did add the range with simple tag but there many beginners Django users out there who dosen't know about this. Also where is the problem????, since templates are almost pythonic in nature (with - for loops and if else) so where is the problem adding a simple default range function to templates. This will in a way make django templates more powerful. Range also give way more possible idea :) On Friday, October 8, 2021 at 7:30:28 PM UTC+5:30 Adam Johnson wrote: > 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 <dhruv...@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-develop...@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/906e7aa2-b814-4ed3-8866-0c33e08bdd77n%40googlegroups.com.