from datetime import date, timedelta
from decimal import Decimal
+from pylons import request
+
log = logging.getLogger(__name__)
class StatusController(BaseController):
c.debts = debts()
c.settle = settle(c.debts)
-
c.total = self._total(True)
year = date.today() - timedelta(days=365)
model.expenditures.c.date >= last_month,
model.expenditures.c.date < this_month))
+ c.expenditures = meta.Session.query(model.Expenditure).\
+ filter(model.Expenditure.spender==request.environ['user']).all()
+ c.transfers = meta.Session.query(model.Transfer).\
+ filter(sqlalchemy.or_(
+ model.Transfer.debtor==request.environ['user'],
+ model.Transfer.creditor==request.environ['user'])).all()
+
return render('/status/index.mako')
def _total(self, where):
<li>${h.link_to('Expenditure for the group', h.url_for(controller='spend', action='index'))}</li>
<li>${h.link_to('Transfer between two people', h.url_for(controller='transfer', action='index'))}</li>
</ul>
+
+<h2>Your History</h2>
+
+${h.link_to('See all history', h.url_for(controller='history',
+ action='index'))}
+
+<h3>Expenditures</h3>
+
+${self.listExpenditures(c.expenditures)}
+
+<h3>Transfers</h3>
+
+${self.listTransfers(c.transfers)}