filter(Split.user == user).\
filter(Split.share != 0).first() is not None)
+ def share(self, user):
+ "Return the share corresponding to ``user``."
+ share = meta.Session.query(Split.share).\
+ filter(Split.expenditure == self).\
+ filter(Split.user == user).scalar()
+ if share is None:
+ return Currency(0)
+ else:
+ return share
+
__all__ = ['Expenditure']
<th class="user">Spender</th>
<th class="description">Description</th>
<th class="amount">Amount</th>
+ <th class="share">My Share</th>
<th class="editlink"></th>
</tr>
% for e in es:
<td class="user">${formatUser(e.spender)}</td>
<td class="description">${e.description}</td>
<td class="amount">${e.amount}</td>
+ <td class="share">${e.share(request.environ['user'])}</td>
<td class="editlink">${h.link_to('Edit', h.url_for(controller='spend', action='edit', id=e.id))}</td>
</tr>
% endfor