Add new choices, operators, and values for models and "is not one of".
Review Request #8331 — Created Aug. 15, 2016 and submitted
This introduces a new set of choices and values for working with
database models, and a new operator for working with "is not one of"
checks.The choices and values make it easy to set up conditions that check
against the database in some form. The values can be supplied with a
queryset or a callable returning a queryset. The choice can be supplied
with a queryset or the subclass can overrideget_queryset()
. Combined
with the new support for attaching extra state the conditions widget
and choices, this allows for much more specialized queries that take
into account things like access permissions for database objects.A new operator,
IsNotOneOfOperator
, was also added for checking if an
item is not in a list of other items. This is the opposite of
OneOfOperator
, which has been renamed toIsOneOfOperator
for
consistency.
Unit tests pass.
Used the new conditions, operators, and values in some upcoming changes
for Review Board.