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


Autocomplete Foreign Keys by default in Admin

2021-10-09 Thread Vasanth Mohan
The admin page for any object becomes ridiculously slow (upto 10s) when the 
object and its multiple inlines have foreign keys. The latency just 
disappears after i added autocomplete for each one manually.

Is there any reason why foreign keys are not autocomplete by default ? Will 
the devs be interested in changing the default behaviour for foreign key in 
admin ? Or accepting a patch for the same?

-- 
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/eafcd382-ba33-48b3-bb8a-7bad12f623a4n%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 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: Django ORM query syntax enhancement

2021-10-09 Thread Asif Saif Uddin

Hi Adam,

I agree with some of your points. however djngo orm query syntax is the 
main pain point for anyone new to django orm.  The reason those packages 
are not widely used is because most people dont know about them and not 
about this DEP. And most new users mainly end up learning built in query 
syntax. not many know much about these Deps and orm syntactic sugars.

If some movement were seen in this front and advocacy then probably there 
will be more attention to syntactic sugar packages. The orm sugar package 
is still works in production with django orm as well. So it would be great 
to see the Dep could be improved based on the both packages good parts.

I think I should try to  write some blogs as well using those packages.

Best,
Asif
On Wednesday, October 6, 2021 at 3:55:58 PM UTC+6 Adam Johnson wrote:

> I would not be for merging anything into Django at this time.
>
> There are several libraries providing "enhanced" query syntax: 
> django-orm-sugar, django-model-values, and django-natural-query. None of 
> them seems to be particularly popular (<100 github stars, minimal PyPI 
> downloads), and only django-model-values is maintained. Moreover they all 
> achieve their goals without any changes to Django, so there's not much of a 
> compelling reason to merge anything to core.
>
> To consider adding "another way to do things" in the ORM we'd want more 
> evidence that users want it. I'd suggest further contributions and advocacy 
> for django-model-values or similar. Its documentation could definitely be 
> improved, and blog posts could promote its advantages.
>
> On Wed, 6 Oct 2021 at 10:13, Asif Saif Uddin  wrote:
>
>> Hey all,
>>
>> can we have some consensus on this?
>>
>> Asif
>>
>> On Saturday, April 1, 2017 at 12:55:27 PM UTC+6 Alexey Zankevich wrote:
>>
>>> Hey all,
>>>
>>> Please check a draft DEP related to external query language support by 
>>> Django ORM https://github.com/django/deps/pull/40. 
>>>
>>> Regards,
>>> Alexey
>>>
>>>
>>> On Wednesday, March 22, 2017 at 10:07:51 AM UTC+3, Asif Saifuddin wrote:

 Hi Aric,

 I checked your package. it's nice too. thanks for the work.

 Asif

 On Monday, October 17, 2016 at 4:38:26 AM UTC+6, Aric Coady wrote:
>
> +1.  I implemented much the same thing for part of django-model-values 
> , but went with F 
> expressions 
>  as the 
> basis instead.  Primarily because F expressions already support operator 
> overloading and are a natural intermediate object;  from there one can 
> create Q, OrderBy, and Func objects.
>
> In []: from model_values import F
>
> In []: F.user.created
> Out[]: FExpr(user__created)
>
> In []: F.user.created >= 0
> Out[]: 
>
> In []: F.user.created.min()
> Out[]: Min(FExpr(user__created))
>
> In []: -F.user.created
> Out[]: OrderBy(FExpr(user__created), descending=True)
>
> In []: F.text.iexact('...')
> Out[]: 
>
>
>
>
> On Thursday, October 6, 2016 at 10:04:56 AM UTC-7, Alexey Zankevich 
> wrote:
>>
>> Hey all,
>>
>> Just want to announce recent changes in Django ORM Sugar library, 
>> which might be useful in future Django query syntax enhancement (if ever 
>> happens).
>> 1. Now it supports indexes and slices:
>>
>> >>> Q.data.owner.other_pets[0].name='Fishy'
>> Q(data__owner__other_pets__0__name='Fishy')
>> >>> Q.tags[0] == 'thoughts'
>> Q(tags__0='thoughts')
>> >>> Q.tags[0:2].contains(['thoughts']) 
>> Q(tags__0_2__contains=['thoughts'])
>>
>>
>> 2. Previously, it was only possible to call defined method (like it 
>> is done for *is_not_null()* function) or registered with decorator. 
>> Now if you try to call unknown function of sugar Q, it will internally 
>> pass 
>> function name and append it as *__functionname *to lookup field:
>>
>> >>> Q.user.username.contains('Rodriguez')
>> Q(user__username__contains='Rodriguez')
>>
>>
>> There is no such function "contains" anymore in sugar Q, however, it 
>> just adds *__contains* to lookup field and passes parameter to it.
>>
>> 3. It will pass a tuple to lookup if multiple arguments passed:
>>
>> >>> Q.user.create_datetime.range(d1, d2)
>> Q(user__create_datetime__range=(d1, d2))
>>
>>
>> I think the library is at the final state now and isn't going to get 
>> new substantial features, but responses are highly appreciated.
>>
>> Regards,
>> Alexey
>>
>>
>> On Sunday, August 16, 2015 at 4:18:26 PM UTC+3, Alexey Zankevich 
>> wrote:
>>>
>>> Hi all,
>>>
>>> This topic is related to the current ORM query syntax with 
>>> underscores.
>>> There are lots of arguing related to it, anyway it has pros and