Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
As I said in my first post, I understand that all three ways are correct. I just wanted to know "the best", which means that it should always give the same results and should not be deprecated in the future. If I understand you correctly, "=None" is most recent implementation of "is null" and (for

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Russell Keith-Magee
On Tue, Oct 20, 2009 at 9:51 PM, Michael P. Jung wrote: > > You're right in one thing. The whole foo=value thing is not documented. >From the "exact" subsection in http://docs.djangoproject.com/en/dev/topics/db/queries/#field-lookups """ For example, the following two

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Michael P. Jung
Михаил Лукин wrote: > For some reason, __exact and __isnull are described in documentation > [1], while =None is not. So which of them are historical? Django pre 1.0 generated bogus SQL, when doing nullable_field=None. These days __isnull can be replaced by the expressions:

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Russell Keith-Magee
On Tue, Oct 20, 2009 at 9:09 PM, Михаил Лукин wrote: > For some reason, __exact and __isnull are described in documentation [1], > while =None is not. So which of them are historical? As I said, __exact and __isnull are historical. The documentation you reference

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
For some reason, __exact and __isnull are described in documentation [1], while =None is not. So which of them are historical? [1] http://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries 2009/10/20 Russell Keith-Magee > > These three queries are all

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Russell Keith-Magee
On Tue, Oct 20, 2009 at 8:21 PM, Михаил Лукин wrote: > There is three ways to select NULL records from table with Django ORM: > > 1. Model.objects.filter(field=None) > 2. Model.objects.filter(field__exact=None) > 3. Model.objects.filter(field__isnull=True) > > They

"...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
There is three ways to select NULL records from table with Django ORM: 1. Model.objects.filter(field=None) 2. Model.objects.filter(field__exact=None) 3. Model.objects.filter(field__isnull=True) They all seem to work. Which is the best way and why? -- regards, Mihail