def _format_dict(self): d = self.__dict__ d['name'] = self.security.name d['symbol'] = self.security.symbol d['cash_value'] = self.cash_value d['del_link'] = build_link(reverse('transactions:del', args=[self.id]), 'Del') d['update_link'] = build_link(reverse('transactions:update', args=[self.id]), 'Update') d['type_cap'] = self.type.capitalize() return d
def as_t(self): last_quote = "<td></td>" if self.quotes.count() > 0: last_quote = "<td>{q:.2f}</td>".format(q=self.quotes.latest().close) return "<td>{symbol}</td>" \ "<td>{name}</td>" \ "<td>{currency}</td>" \ "<td>{list_date}</td>" \ "<td>{quote_count}</td>".format( symbol=build_link(reverse('securities:detail', args=[self.id]), self.symbol), name=self.name, currency=self.currency, list_date=self.list_date, quote_count=self.quotes.count()) + last_quote
def as_t(self): return "<td>{sec_link}</td>" \ "<td>{symbol}</td>" \ "<td>{currency}</td>" \ "<td>{shares}</td>" \ "<td>{cost:.2f}</td>" \ "<td>{cost_s:.2f}</td>" \ "<td>{value:.2f}</td>" \ "<td>{dividend:.2f}</td>" \ "<td>{gain:.2f}</td>".format( sec_link=build_link(reverse('securities:detail', args=[self.security.id]), self.security.name), symbol=self.security.symbol, currency=self.security.currency, shares=self.shares, cost=self.cost, cost_s=self.cost_per_share(), dividend=self.dividend, gain=self.gain, value=self.value, )