Support updating many fields on CounterField.

Review Request #5279 — Created Jan. 20, 2014 and submitted

Information

Djblets
master

Reviewers

This adds two new class methods for CounterField: increment_many, and
decrement_many. These can be used for incrementing or decrementing many
fields at once on an instance of a model.

It also makes two changes to saving field values.

An initializer can now return None, meaning that CounterField won't set
the field and save the object. That's intended for when an initializer
will be handling setting the field itself, perhaps through
increment_many() or update().

When saving the field, CounterField now passes update_fields to save(),
ensuring we only save those affected fields and don't unintentionally
save other aspects of the model.

Tested along with a change on Review Board that makes extensive use
of these functions.

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...