#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
-------------------------------------+-------------------------------------
Description changed by tschuy:

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:
>
> 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.

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:3>
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.3d568e7ed472202fda85596841ef539e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to