In django I tend to check for changes and call save only if needed. For example I have the following code.
# self == some Model...
save_required = False
if self.pct_complete != pct_complete:
self.pct_complete = pct_complete
save_required = True
if self.phase_pct_complete != phase_pct_complete:
self.phase_pct_complete = phase_pct_complete
save_required = True
if self.is_eligible_for_next_phase != is_eligible_for_next_phase:
self.is_eligible_for_next_phase = is_eligible_for_next_phase
save_required = True
if save_required:
self.save()
This was based on the comment I read where Django does not appear to track "before" vs. "after" states of a model.
The question:
I using others apps don't see many people tracking states and saving only when needed. Is there a reason for this or am I being overly paranoid?