Re: Why can't range function be added in templates?

2021-10-10 Thread Dhruva Shaw
well my bad, tbh i wasn't shouting, just that caps was mistakenly on. If 
ever I was shouting then I would be using some words which wouldn't be 
appealing, :thinking: is bruh noo.. a slang or just an expression came out 
of shock! , i believe anyways `bruh no` is not a slang, *anyways nvm*
On Saturday, October 9, 2021 at 4:15:11 PM UTC+5:30 Adam Johnson wrote:

> Please don't use shouty capitals or angry slang like "Bruh no" on this 
> mailing list. This mailing list is for calm professional discussion.
>
> On Sat, 9 Oct 2021 at 11:35, Dhruva Shaw  wrote:
>
>> SINCE THE NO OF SELECT BOXES THAT I HAVE GENERATE COMES DIRECTLY FROM THE 
>> DATABSE, THUS RANGE FUNCTION IS NEEDED!
>>
>> On Saturday, October 9, 2021 at 2:40:29 PM UTC+5:30 f.apo...@gmail.com 
>> wrote:
>>
>>> On Friday, October 8, 2021 at 6:14:19 PM UTC+2 dhruv...@gmail.com wrote:
>>>
 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

>>>
>>> Why was "|range" added there? You are not using {{ j }} there at all but 
>>> {{ forloop.counter }}. There doesn't seem to be any reason to use "|range" 
>>> there. 
>>>
>> -- 
>>
> 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/3e733a40-b9a0-4bc7-ba87-943bc5aee635n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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/c06c5991-7e5a-46b9-81b8-c358676d80dbn%40googlegroups.com.


Re: Why can't range function be added in templates?

2021-10-09 Thread Dhruva Shaw
Yup I agree that template system is added bonus, then why not more power to 
it? I do believe that it could be easily added but there are many beginners 
out who dont know how to implement and there many complex solutions present 
over the inetrnet.


well ` j.squad_entry_members` is no (dataype int) its not a list, since its 
a no thus numeric loop is required :)  (if you do ` for i in 
j.squad_entry_members` and since ` j.squad_entry_members` is an int so lets 
suppose that ` j.squad_entry_members` has a value of 2 then i would hold 
the value 2 and for loop will be run once which i don't , i want that for 
loop to be run twice ) :)

On Saturday, October 9, 2021 at 11:45:25 PM UTC+5:30 Benny wrote:

> FWIW The template system always seemed like an added bonus to the project. 
> Which is fine because, personally, I’d rather more effort go into the guts 
> than the lipstick anyway. 
>
> It’s easy enough to build custom filters, or even exploit some of the 
> quirks of the system… so much so that asking the core team to address this 
> over just building or forking a third-party package is superfluous. 
>
> All that said, it loos like you’re trying to build form fields based on a 
> predetermined, um, range of results. It looks to me this can be addressed 
> by having one more nested loop. So you have `for i in group` then `for j in 
> i.game` - you could add something like `for k in j.squad_entry_members`. 
> This would skip the need for a range, fall within the system specs, and 
> gets you a free counter without having to know the specific size.
>  
>
> Benny
>
> On Oct 9, 2021, at 5:45 AM, 'Adam Johnson' via Django developers 
> (Contributions to Django itself)  wrote:
>
> 
>
> Please don't use shouty capitals or angry slang like "Bruh no" on this 
> mailing list. This mailing list is for calm professional discussion.
>
> On Sat, 9 Oct 2021 at 11:35, Dhruva Shaw  wrote:
>
>> SINCE THE NO OF SELECT BOXES THAT I HAVE GENERATE COMES DIRECTLY FROM THE 
>> DATABSE, THUS RANGE FUNCTION IS NEEDED!
>>
>> On Saturday, October 9, 2021 at 2:40:29 PM UTC+5:30 f.apo...@gmail.com 
>> wrote:
>>
>>> On Friday, October 8, 2021 at 6:14:19 PM UTC+2 dhruv...@gmail.com wrote:
>>>
 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

>>>
>>> Why was "|range" added there? You are not using {{ j }} there at all but 
>>> {{ forloop.counter }}. There doesn't seem to be any reason to use "|range" 
>>> there. 
>>>
>> -- 
>> 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/3e733a40-b9a0-4bc7-ba87-943bc5aee635n%40googlegroups.com
>>  
>> 
>> .
>>
> -- 
> 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/CAMyDDM3MsvujxsH_QtHyO4Pqo6Vgtd1bG%2BTHB4_GYx%2BpQ2xGRA%40mail.gmail.com
>  
> 
> .
>
>

-- 
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/d1c775c5-8528-462a-b1c9-200c12b4cfeen%40googlegroups.com.


Re: Why can't range function be added in templates?

2021-10-09 Thread Benny
FWIW The template system always seemed like an added bonus to the project. 
Which is fine because, personally, I’d rather more effort go into the guts than 
the lipstick anyway. 

It’s easy enough to build custom filters, or even exploit some of the quirks of 
the system… so much so that asking the core team to address this over just 
building or forking a third-party package is superfluous. 

All that said, it loos like you’re trying to build form fields based on a 
predetermined, um, range of results. It looks to me this can be addressed by 
having one more nested loop. So you have `for i in group` then `for j in 
i.game` - you could add something like `for k in j.squad_entry_members`. This 
would skip the need for a range, fall within the system specs, and gets you a 
free counter without having to know the specific size.
 

Benny

> On Oct 9, 2021, at 5:45 AM, 'Adam Johnson' via Django developers 
> (Contributions to Django itself)  wrote:
> 
> 
> Please don't use shouty capitals or angry slang like "Bruh no" on this 
> mailing list. This mailing list is for calm professional discussion.
> 
>> On Sat, 9 Oct 2021 at 11:35, Dhruva Shaw  wrote:
>> SINCE THE NO OF SELECT BOXES THAT I HAVE GENERATE COMES DIRECTLY FROM THE 
>> DATABSE, THUS RANGE FUNCTION IS NEEDED!
>> 
>>> On Saturday, October 9, 2021 at 2:40:29 PM UTC+5:30 f.apo...@gmail.com 
>>> wrote:
 On Friday, October 8, 2021 at 6:14:19 PM UTC+2 dhruv...@gmail.com wrote:
 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
>>> 
>>> Why was "|range" added there? You are not using {{ j }} there at all but {{ 
>>> forloop.counter }}. There doesn't seem to be any reason to use "|range" 
>>> there. 
>> 
>> -- 
>> 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/3e733a40-b9a0-4bc7-ba87-943bc5aee635n%40googlegroups.com.
> 
> -- 
> 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/CAMyDDM3MsvujxsH_QtHyO4Pqo6Vgtd1bG%2BTHB4_GYx%2BpQ2xGRA%40mail.gmail.com.

-- 
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/32AF05A5-DFD8-47A0-A671-959FAB725980%40twosensedesign.com.


Re: Why can't range function be added in templates?

2021-10-09 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Please don't use shouty capitals or angry slang like "Bruh no" on this
mailing list. This mailing list is for calm professional discussion.

On Sat, 9 Oct 2021 at 11:35, Dhruva Shaw  wrote:

> SINCE THE NO OF SELECT BOXES THAT I HAVE GENERATE COMES DIRECTLY FROM THE
> DATABSE, THUS RANGE FUNCTION IS NEEDED!
>
> On Saturday, October 9, 2021 at 2:40:29 PM UTC+5:30 f.apo...@gmail.com
> wrote:
>
>> On Friday, October 8, 2021 at 6:14:19 PM UTC+2 dhruv...@gmail.com wrote:
>>
>>> 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
>>>
>>
>> Why was "|range" added there? You are not using {{ j }} there at all but
>> {{ forloop.counter }}. There doesn't seem to be any reason to use "|range"
>> there.
>>
> --
> 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/3e733a40-b9a0-4bc7-ba87-943bc5aee635n%40googlegroups.com
> 
> .
>

-- 
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/CAMyDDM3MsvujxsH_QtHyO4Pqo6Vgtd1bG%2BTHB4_GYx%2BpQ2xGRA%40mail.gmail.com.


Re: Why can't range function be added in templates?

2021-10-09 Thread Dhruva Shaw
SINCE THE NO OF SELECT BOXES THAT I HAVE GENERATE COMES DIRECTLY FROM THE 
DATABSE, THUS RANGE FUNCTION IS NEEDED!

On Saturday, October 9, 2021 at 2:40:29 PM UTC+5:30 f.apo...@gmail.com 
wrote:

> On Friday, October 8, 2021 at 6:14:19 PM UTC+2 dhruv...@gmail.com wrote:
>
>> 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
>>
>
> Why was "|range" added there? You are not using {{ j }} there at all but 
> {{ forloop.counter }}. There doesn't seem to be any reason to use "|range" 
> there. 
>

-- 
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/3e733a40-b9a0-4bc7-ba87-943bc5aee635n%40googlegroups.com.


Re: Why can't range function be added in templates?

2021-10-09 Thread Dhruva Shaw
BRUHHH NOOO, I HAVE TO GENERATE A NO OF SELECT BOXES , AND HAVE MANY SELECT 
BOXES WILL GENERATED COMES DIRECTLY FROM THE DATABSE


On Saturday, October 9, 2021 at 2:40:29 PM UTC+5:30 f.apo...@gmail.com 
wrote:

> On Friday, October 8, 2021 at 6:14:19 PM UTC+2 dhruv...@gmail.com wrote:
>
>> 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
>>
>
> Why was "|range" added there? You are not using {{ j }} there at all but 
> {{ forloop.counter }}. There doesn't seem to be any reason to use "|range" 
> there. 
>

-- 
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/73924279-4cff-4070-b57c-33bf861307a0n%40googlegroups.com.


Re: Why can't range function be added in templates?

2021-10-09 Thread Florian Apolloner


On Friday, October 8, 2021 at 6:14:19 PM UTC+2 dhruv...@gmail.com wrote:

> 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
>

Why was "|range" added there? You are not using {{ j }} there at all but {{ 
forloop.counter }}. There doesn't seem to be any reason to use "|range" 
there. 

-- 
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/987fbb10-1575-4897-b699-1bbdb0cf817an%40googlegroups.com.


Re: Why can't range function be added in templates?

2021-10-08 Thread Dhruva Shaw
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  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
>>  
>> 
>> .
>>
>

-- 
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.


Re: Why can't range function be added in templates?

2021-10-08 Thread Dhruva Shaw
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 
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 range 
function.

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  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
>>  
>> 
>> .
>>
>

-- 
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/def05c1d-e794-4709-86f9-082382aa95f7n%40googlegroups.com.


Re: Why can't range function be added in templates?

2021-10-08 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
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  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
> 
> .
>

-- 
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.


Why can't range function be added in templates?

2021-10-02 Thread Dhruva Shaw
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.