#5763: Queryset doesn't have a "not equal" filter operator
-------------------------------------+-------------------------------------
Reporter: jdetaeye | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) | Resolution: wontfix
Severity: Normal | Triage Stage: Design
Keywords: qs-rf | decision needed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by akaariai):
Be warned - not using subqueries might actually produce incorrect results.
Specifically, .exclude() guarantees that you get the complement of what
you get with .filter(). There are cases where `field__ne` will not produce
the complement of `field__exact`. This happens for example if the field
has NULL values. Both `__exact` and `__ne` will miss such rows, as in SQL
terms both 'val = NULL' and 'val != NULL' have unknown result.
As mjtamlyn noted a `__ne` lookup will be fairly straightforward to
implement in 1.7. Check https://docs.djangoproject.com/en/dev/ref/models
/custom-lookups/ for details.
--
Ticket URL: <https://code.djangoproject.com/ticket/5763#comment:19>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.71f3d78418ccc186822554f4ef4aa5ac%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.