Opened 9 years ago

Last modified 5 years ago

#25113 closed New feature

Field lookup for __not_in — at Version 3

Reported by: Evan Tschuy Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Evan Tschuy)

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.

Change History (3)

comment:1 by Evan Tschuy, 9 years ago

Description: modified (diff)

comment:2 by Evan Tschuy, 9 years ago

Description: modified (diff)

comment:3 by Evan Tschuy, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top