#25113: Field lookup for __not_in
-------------------------------------+-------------------------------------
Reporter: tschuy | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by tschuy):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> Making a query where I can get all of the objects matching a certain list
> is quite useful. However, Django currently doesn't allow me to get
> objects that DON'T match a list:
>
> `test = ProductPreparation.objects.filter(
> product=product,
> preparation__id__not_in=preparations)`
>
> I feel like adding a field lookup for __not_in would be helpful. I've
> created a pull request on Github.
New description:
Making a query where I can get all of the objects matching a certain list
is quite useful. However, Django currently doesn't allow me to get objects
that DON'T match a list:
`test = ProductPreparation.objects.filter(
product=product,
preparation__id__not_in=preparations)`
I feel like adding a field lookup for `__not_in` would be helpful. I've
created a pull request on Github:
https://github.com/django/django/pull/4984
I've not added any tests to it, as I couldn't find any tests for ``__in``,
and don't quite know how to test an entire field lookup. Apologies; would
love pointers.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25113#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 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/064.cbe7b5faa9a60223a8b12a8ff14a37d9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.