diff --git a/django/didgeridoo/currencies/exchange_rates.py b/django/didgeridoo/currencies/exchange_rates.py index 2900892..db1cc6b 100644 --- a/django/didgeridoo/currencies/exchange_rates.py +++ b/django/didgeridoo/currencies/exchange_rates.py @@ -110,7 +110,7 @@ def get_exchange_rate(): # CHFvalue, "CHF and 1 ", base_currency, " costs: ", # FOREIGNvalue_round, target_currency) exchange_rates.update( - {target_currency: FOREIGNvalue_round}) + {target_currency: FOREIGNvalue_round, "date": date}) # Print the Dictionary: # print(exchange_rates) else: diff --git a/django/didgeridoo/currencies/migrations/0002_exchangerate_date.py b/django/didgeridoo/currencies/migrations/0002_exchangerate_date.py new file mode 100644 index 0000000..37fb831 --- /dev/null +++ b/django/didgeridoo/currencies/migrations/0002_exchangerate_date.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2017-12-27 10:05 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('currencies', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='exchangerate', + name='date', + field=models.DateField(null=True), + ), + ] diff --git a/django/didgeridoo/currencies/migrations/0003_auto_20171227_1119.py b/django/didgeridoo/currencies/migrations/0003_auto_20171227_1119.py new file mode 100644 index 0000000..c6283a2 --- /dev/null +++ b/django/didgeridoo/currencies/migrations/0003_auto_20171227_1119.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2017-12-27 10:19 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('currencies', '0002_exchangerate_date'), + ] + + operations = [ + migrations.AlterField( + model_name='exchangerate', + name='date', + field=models.DateField(null=True, verbose_name='%Y-%m-%d'), + ), + ] diff --git a/django/didgeridoo/currencies/models.py b/django/didgeridoo/currencies/models.py index 1edbe06..fb6d10c 100644 --- a/django/didgeridoo/currencies/models.py +++ b/django/didgeridoo/currencies/models.py @@ -3,6 +3,7 @@ from django.db import models class ExchangeRate(models.Model): name = models.CharField(max_length=200, unique=True) + date = models.DateField('%Y-%m-%d', null=True) exchange_rate_to_chf = models.FloatField(max_length=5) def __str__(self): diff --git a/django/didgeridoo/currencies/templates/currencies/index.html b/django/didgeridoo/currencies/templates/currencies/index.html index 3c1e8a7..50d944a 100644 --- a/django/didgeridoo/currencies/templates/currencies/index.html +++ b/django/didgeridoo/currencies/templates/currencies/index.html @@ -8,11 +8,17 @@ {% if currency_list %}
No categories are available.
++ Something whent wrong, no currencies are available. +
{% endif %}