Handle running totals in models and templates