Re: Please add exists subquery to queryset api

2014-11-11 Thread George Ma
Yes, that's the query i'd like to have.

On Monday, November 10, 2014 10:38:41 PM UTC-7, Curtis Maloney wrote:
>
> Can you provide the "natural" SQL version you'd rather see generated?
>
> Something like:
>
> SELECT ... FROM myapp_a WHERE NOT EXISTS (SELECT 1 FROM myapp_b T1 WHERE 
> T1.a_id = myapp_a.id AND T1.criteria = True)
>
> perhaps?
>
>
> On 11 November 2014 16:18, George Ma  
> wrote:
>
>> Yes, the actual sql is very close to this one. But I just feel this 
>> approach is like a hack. Because I always have to reverse the logic first 
>> and then reverse again. Not as natural as exists subquery.
>>
>> On Monday, November 10, 2014 5:53:47 PM UTC-7, Curtis Maloney wrote:
>>>
>>> If you want to know the SQL generated for any particular queryset, you 
>>> can just:
>>>
>>> print str(qs.query)
>>>
>>> On 11 November 2014 11:39, George Ma  wrote:
>>>
 For simplicity, let's assume we have a model A and model B.

 class A(models.Model):
 name = models.CharField(max_length=200)

 class B(models.Model):
 a = models.ForeignKey(A)
 criteria = models.BooleanField(default = False)

 Let's say there's a requirement to find A that doesn't have a B with a 
 true criteria. To me, it makes more sense to use a "not exists" subquery. 
 Right now, I have to find all the A with the reverse conditions and 
 exclude 
 such cases. Something like:

 A.objects.exclude(pk__in = A.objects.filter(b__criteria = True))

>>>
>>> I think you'll find this would be something like:
>>>
>>> SELECT  FROM myapp_a WHERE NOT pk IN (SELECT id FROM myapp_a T1 
>>> INNER JOIN myapp_b T2 ON (T1.id = T2.a_id) WHERE T2.criteria = True)
>>>
>>> The problem with this approach is that: first I don't know how the 
 performance would be; second, it's not very natural from sql query's 
 perspective.

>>>
>>> Performance should be ok, from what I can see...
>>>
>>> Would be interested to see what the actual SQL is.
>>>
>>> --
>>> Curtis
>>>
>>>  -- 
>> 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 post to this group, send email to django-d...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-developers.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/19f716f4-2367-492c-ac1e-a4f48c4a2c01%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/65e5d984-51de-4836-a413-018a3c0e1912%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Explicit relative imports

2014-11-11 Thread Marc Tamlyn
I agree wholeheartedly. (Sorry, not much else to say...)

On 11 November 2014 21:51, Aymeric Augustin <
aymeric.augus...@polytechnique.org> wrote:

> Hello,
>
> We’ve started using explicit relative imports in newer parts of the Django
> source tree. They’re short and readable. That’s good.
>
> I would like to add guidelines about imports in the coding style guide in
> order to improve consistency.
>
> My inclination would be to recommend relative imports within “components”
> but avoid them between “components”, where a component is:
>
> - a well-defined sub-framework (django.core.cache, django.db,
> django.forms, django.template, etc.)
> - a contrib app
> - an app in the tests/ directory
> - etc.
>
> I would discourage going back into parent modules with relative imports
> because statements such as `from ...spam import eggs` are hard to parse.
>
> You can see an example of this style in django.apps which has only three
> files.
>
> What do you think?
>
> --
> Aymeric.
>
>
>
> --
> 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 http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/9FFE2185-6F9D-41EE-8A19-16C5538E6B53%40polytechnique.org
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMwjO1EHGVyDfiuh1aYtXJkd2M51jOjPfwAPmUtB0dw%2B47voZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Explicit relative imports

2014-11-11 Thread Aymeric Augustin
Hello,

We’ve started using explicit relative imports in newer parts of the Django 
source tree. They’re short and readable. That’s good.

I would like to add guidelines about imports in the coding style guide in order 
to improve consistency.

My inclination would be to recommend relative imports within “components” but 
avoid them between “components”, where a component is:

- a well-defined sub-framework (django.core.cache, django.db, django.forms, 
django.template, etc.)
- a contrib app
- an app in the tests/ directory
- etc.

I would discourage going back into parent modules with relative imports because 
statements such as `from ...spam import eggs` are hard to parse.

You can see an example of this style in django.apps which has only three files.

What do you think?

-- 
Aymeric.



-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9FFE2185-6F9D-41EE-8A19-16C5538E6B53%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.


Running flake8 on pull requests

2014-11-11 Thread Aymeric Augustin
Hello,

Since we started using flake8, we made many small commits to fix glitches.

Would it be possible to run flake8 on Jenkins when testing pull requests?

I think that would help.

-- 
Aymeric.



-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/3EA681D3-B1E6-4E47-82CB-800924F6AAF2%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.


Re: Django Mptt Admin as an inline form

2014-11-11 Thread Tom Christie
Hi Neeraj,

This group is for discussion of development of Django itself.
You want the 'Django users' group, 
here... https://groups.google.com/forum/#!forum/django-users

All the best,

  Tom

-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b61ef35a-8ef8-4aa8-92a3-f390d7a4f27e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Mptt Admin as an inline form

2014-11-11 Thread Neeraj Sharma
I want to use Django Mptt Admin as an inline form in admin.py , please help 
me on this.

-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7c3a3e03-80da-48a4-a0bf-c0a4b075ac1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Swampdragon, the realtime framework for Django seems interesting. But will it scale ?

2014-11-11 Thread Florian Apolloner
Hi,

this mailing list is about the development of Django itself -- you are 
better off in django-users.

Cheers,
Florian

On Tuesday, November 11, 2014 6:54:34 AM UTC+1, Suren Sth wrote:
>
> I recently came across Swampdragon ( Visit official site 
> ). I am curious can it be used in production 
> sites and will it scale ? If it can be, what is the best way?
>

-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1fc80c0a-96c0-4228-ad5c-dba95213e3f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Swampdragon, the realtime framework for Django seems interesting. But will it scale ?

2014-11-11 Thread Suren Sth
I recently came across Swampdragon ( Visit official site 
). I am curious can it be used in production sites 
and will it scale ? If it can be, what is the best way?

-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/868a215b-c0ec-4ed8-b603-d9835e6c84e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin bug that causes data loss need attention

2014-11-11 Thread Josh Smeaton
I don't think a doc patch is sufficient to address the problem, and I 
highly doubt that a warning would be heard by the vast majority. The 
attention this bug needs is someone to write a patch to fix the code. 
Looking at the ticket, 4 weeks ago someone suggested some code that *may* 
fix the problem. If you were to test the change by modifying your local 
django and validating that the fix works, I'd think that someone would be 
more likely to step up and make it committable.

Fixing bugs like this takes a lot of work. Someone needs to identify the 
issue, verify the problem, write a test case to prove it, track down the 
issue in code, figure out how it might be corrected, test that it works, 
perhaps write another test, run the test suite, add release notes, and get 
it reviewed. Every bug in trac competes for this time. If you're able to 
effectively halve the time needed, that issue becomes a lot more attractive 
to 'finish'.

I'll even put my hand up to try to fix it if you verify that the patch in 
the ticket from 4 weeks ago works. I don't (yet) have much experience with 
the admin, but if there is a straight forward fix available, that'll be a 
good introduction for me.

Regards,

Josh

-- 
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/91ad25c1-8fa9-4487-8e38-afb193ca076f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.