display the exchangerate with name and value

This commit is contained in:
Andreas Zweili 2018-03-02 14:54:54 +01:00
parent c38a9b1e16
commit fded4a80f9
1 changed files with 2 additions and 2 deletions

View File

@ -23,7 +23,7 @@ class ExchangeRate(models.Model):
def exchange(_currency_id, _base_currency):
rate = ExchangeRate.objects.filter(name=_currency_id).latest('date')
return round(rate.exchange_rate_to_chf * _base_currency,2)
return round(rate.exchange_rate_to_chf * _base_currency, 2)
def __str__(self):
return str(self.name)
return '{} {}'.format(self.exchange_rate_to_chf, self.name)