#16893: negation of Q object returns the same thing
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  morgy.wahl@…                       |         Status:  new
                   Type:  Bug        |      Component:  Database layer
              Milestone:             |  (models, ORM)
                Version:  1.2        |       Severity:  Normal
             Resolution:             |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |    Needs tests:  0
    Needs documentation:  0          |  Easy pickings:  0
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

 * needs_docs:   => 0
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Old description:

> Not sure if this is a bug.
>
> I was attempt to construct a Q object that wouldn't ever match anything
> (an API calls for a Q object to be returned, but certain situations call
> for nothing to be matched by it). I initially figured
>
> ~ Q()
>
> Would do the trick, but that matches everything, just like a plain Q().
>
> (I ended up using Q(pk__isnull=True), which is a hack but seems to be
> OK.)

New description:

 Not sure if this is a bug.

 I was attempt to construct a Q object that wouldn't ever match anything
 (an API calls for a Q object to be returned, but certain situations call
 for nothing to be matched by it). I initially figured `~ Q()` would do the
 trick, but that matches everything, just like a plain `Q()`.

 (I ended up using `Q(pk__isnull=True)`, which is a hack but seems to be
 OK.)

--

Comment:

 Fixed formatting (you can use "preview" before submitting a ticket).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16893#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to