def to_representation(self, obj): ret = super(TransactionSerializer, self).to_representation(obj) ret.update({ 'description': as_html_description(obj), 'is_debit': self._is_debit(obj), 'amount': as_money(obj.dest_amount, '-%s' % obj.dest_unit if self._is_debit(obj) else obj.dest_unit)}) return ret
def to_representation(self, obj): ret = super(TransactionSerializer, self).to_representation(obj) is_debit = self._is_debit(obj) if is_debit: amount = as_money(obj.orig_amount, '-%s' % obj.orig_unit) else: amount = as_money(obj.dest_amount, obj.dest_unit) ret.update({ 'description': as_html_description(obj), 'is_debit': is_debit, 'amount': amount}) return ret
def to_representation(self, obj): ret = super(TransactionSerializer, self).to_representation(obj) ret.update({ 'description': as_html_description(obj), 'is_debit': self._is_debit(obj), 'amount': as_money( obj.dest_amount, '-%s' % obj.dest_unit if self._is_debit(obj) else obj.dest_unit) }) return ret
def to_representation(self, obj): ret = super(TransactionSerializer, self).to_representation(obj) is_debit = self._is_debit(obj) if is_debit: amount = as_money(obj.orig_amount, '-%s' % obj.orig_unit) else: amount = as_money(obj.dest_amount, obj.dest_unit) ret.update({ 'description': as_html_description(obj, provider=get_current_provider()), 'is_debit': is_debit, 'amount': amount }) return ret
def describe(transaction): return mark_safe(as_html_description(transaction))
def describe(transaction): return mark_safe(as_html_description( transaction, provider=get_current_provider()))