Add new choices, operators, and values for models and "is not one of".

Review Request #8331 — Created Aug. 15, 2016 and submitted

Information

Djblets
release-0.10.x
c593066...

Reviewers

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 override get_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 to IsOneOfOperator for
consistency.

Unit tests pass.

Used the new conditions, operators, and values in some upcoming changes
for Review Board.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/conditions/values.py
        djblets/conditions/operators.py
        djblets/conditions/choices.py
        djblets/conditions/tests/test_values.py
        djblets/conditions/tests/test_operators.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/conditions/values.py
        djblets/conditions/operators.py
        djblets/conditions/choices.py
        djblets/conditions/tests/test_values.py
        djblets/conditions/tests/test_operators.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (35dba33)
Loading...