Discuss: Add a new setting for https schema

2017-08-20 Thread wangwenpei
Dear all:

   I know we have *settings.SECURE_PROXY_SSL_HEADER *to control https 
header when we use load-balancer.

   but I found some small cloud platform doesn't support user set it. 

   so, should we add new config option to support this case, something 
like: *'SCHEMA_FORCE_HTTPS=True'?*

   I am not sure this is a feature. because it is cloud platform problem, 
not Django.

   if community think  can add into django. I think I can finish it.

 




-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e08a47f2-105e-4a89-a749-d09c36e19c4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Discuss: Add a new setting for https schema

2017-08-20 Thread Florian Apolloner
I think in those cases a small middleware would be prefered opposed to a 
new setting (and therefore nothing which needs to be in core). That said: 
how is the "cloud" telling you if the request is https or not?

Cheers,
Florian

On Sunday, August 20, 2017 at 7:03:08 PM UTC+2, wangwenpei wrote:
>
> Dear all:
>
>I know we have *settings.SECURE_PROXY_SSL_HEADER *to control https 
> header when we use load-balancer.
>
>but I found some small cloud platform doesn't support user set it. 
>
>so, should we add new config option to support this case, something 
> like: *'SCHEMA_FORCE_HTTPS=True'?*
>
>I am not sure this is a feature. because it is cloud platform problem, 
> not Django.
>
>if community think  can add into django. I think I can finish it.
>
>  
>
>
>
>
>

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/996fbf8f-00b9-4efb-8c45-ee17c9e05df5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Optimizing out unused annotations from count queries

2017-08-20 Thread Anssi Kääriäinen
On Sunday, August 20, 2017 at 2:48:23 AM UTC+3, Josh Smeaton wrote:

> Thanks for making me elaborate, because I'm probably wrong. I'll step 
> through what my thinking was though.
>
> '.annotate(local=F('related__field'))' will join to the related table. If 
> `related` is a nullable foreign key, then a join would do an implicit 
> filter, removing the row from the result set if it had no relation, and 
> reducing the count. 
>
> But Django models a nullable foreign key join as a LEFT JOIN which 
> wouldn't filter the row out and wouldn't reduce the count.
>
> Multivalue relationships (reverse foreign key and m2m joins) would need 
> some care though I think. I'm not sure if the same annotation above works 
> on m2m joins or not.
>

Interestingly enough, just doing a .filter(m2m_relation__foo='bar') might 
change the results. For m2m relations, any non-aggregate annotation is not 
safe to remove.

I believe our test cases are not fully covering here, so removing the 
annotations will be a bit risky. If there are cases where removal is known 
to be safe, it's of course a good idea to remove anything extra from the 
query.

 - Anssi 

-- 
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 post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/51a5c1ad-e071-482b-aa3a-184dd4145413%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.