On 6/15/07, Nicholas Ding <[EMAIL PROTECTED]> wrote:
> But why not add a 'ne' term to do this?
> eg. Foo.objects.filter(column1__ne='', column2__ne='')
> I think it's more simple.
Older versions of Django supported that, but the current 'exclude'
syntax is a little more robust in terms of things
It works!
But why not add a 'ne' term to do this?
eg. Foo.objects.filter(column1__ne='', column2__ne='')
I think it's more simple.
Thanks.
On 6/15/07, Nick <[EMAIL PROTECTED]> wrote:
>
>
> On Jun 15, 12:50 pm, "Nicholas Ding" <[EMAIL PROTECTED]> wrote:
> > but I wanna 'where column1 <> %s and col
On Jun 15, 12:50 pm, "Nicholas Ding" <[EMAIL PROTECTED]> wrote:
> but I wanna 'where column1 <> %s and column2 <> %s'
> If I were using exclude, the SQL must be 'where not (column1 = %s and
> column2 = %s), that's different.
http://www.djangoproject.com/documentation/db-api/#complex-lookups-with-
On Jun 15, 3:50 pm, "Nicholas Ding" <[EMAIL PROTECTED]> wrote:
> but I wanna 'where column1 <> %s and column2 <> %s'
> If I were using exclude, the SQL must be 'where not (column1 = %s and
> column2 = %s), that's different.
I think you want:
objects.exclude(column1=test1).exclude(column2=test2)
You can do a custom SQL query. I don't think you'd *have* to for this,
but someone else will have to provide the correct translation.
Todd
On Fri, 2007-06-15 at 11:50 +0800, Nicholas Ding wrote:
> but I wanna 'where column1 <> %s and column2 <> %s'
> If I were using exclude, the SQL must be 'whe
but I wanna 'where column1 <> %s and column2 <> %s'
If I were using exclude, the SQL must be 'where not (column1 = %s and
column2 = %s), that's different.
On 6/15/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
>
>
> Django uses different functions for this. To get the opposite of this
> (the ne versi
Django uses different functions for this. To get the opposite of this
(the ne version)
Foo.objects.filter(bar__exact='something')
do
Foo.objects.exclude(bar__exact='something')
HTH,
Todd
On Fri, 2007-06-15 at 11:37 +0800, Nicholas Ding wrote:
> I found Django can not do '<>' operation in SQL,
7 matches
Mail list logo