Add support for using F() expressions in CounterField initialization.

Review Request #6242 — Created Aug. 18, 2014 and submitted

Information

Djblets
release-0.8.x
4d686a1...

Reviewers

CounterField intializers can now return a F() expression in the
initializer function, or provide the expression instead of a function,
instead of returning a numeric value. These will be passed to the
database query, allowing for atomic computation of initial counter
state.

Since we didn't have unit tests for CounterField before, this comes with
a set of tests for the new functionality and much of the original
functionality.

Unit tests pass.

Description From Last Updated

local variable 'f_expr' is assigned to but never used

reviewbotreviewbot

local variable 'expr' is assigned to but never used

reviewbotreviewbot
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        djblets/db/fields.py
        djblets/db/tests.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        djblets/db/fields.py
        djblets/db/tests.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/db/fields.py
        djblets/db/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/db/fields.py
        djblets/db/tests.py
    
    
  2. djblets/db/tests.py (Diff revision 2)
     
     
    Show all issues
     local variable 'f_expr' is assigned to but never used
    
  3. djblets/db/tests.py (Diff revision 2)
     
     
    Show all issues
     local variable 'expr' is assigned to but never used
    
  4. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/db/fields.py
        djblets/db/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/db/fields.py
        djblets/db/tests.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
  1. Bah.. There are issues with this. Django doesn't allow aggregates when updating.

    I'll be toying with some other changes and then update this with some new code.

  2. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/db/tests/test_counter_field.py
        djblets/db/fields.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/db/tests/test_counter_field.py
        djblets/db/fields.py
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.8.x (1a85c35)