From e65e901a6698d87d09d3ef1f6b0818f4916c864b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCnch?= Date: Mon, 5 Jul 2021 20:45:21 +0000 Subject: [PATCH] fix #48 aka. show recent coins on index page --- coinmanager/coinc/templates/coinc/index.html | 2 +- coinmanager/coinc/templates/footer.html | 2 +- coinmanager/coinc/views.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/coinmanager/coinc/templates/coinc/index.html b/coinmanager/coinc/templates/coinc/index.html index fdbd127..16654cb 100644 --- a/coinmanager/coinc/templates/coinc/index.html +++ b/coinmanager/coinc/templates/coinc/index.html @@ -4,7 +4,7 @@ {% include 'coinc/filter_country.html' with countrys=countrys %}

Zuletzt hinzugefügt

{% for coin in recent_coins %} -

{{ coin.found_on|date:"d.m.Y" }}: {{ coin.value }}€ {{ coin.name }} von {{ coin.found_by }}

+

{{ coin.found_on|date:"d.m.Y" }}: {{ coin.value|floatformat:2 }} € {{ coin.name }} von {{ coin.found_by }}

{% endfor %} {% else %}

Trage zuerst Länder im Adminbereich ein.

{% endif %} diff --git a/coinmanager/coinc/templates/footer.html b/coinmanager/coinc/templates/footer.html index fff96a3..825fc56 100644 --- a/coinmanager/coinc/templates/footer.html +++ b/coinmanager/coinc/templates/footer.html @@ -1,3 +1,3 @@ - Version 201026 + Version 210705 diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py index 2765735..35eff64 100644 --- a/coinmanager/coinc/views.py +++ b/coinmanager/coinc/views.py @@ -42,8 +42,8 @@ def index(request): users = User.objects.order_by('id') coin_sum = total_coin_sum() recent_coins = Coin.objects.order_by('-found_on')[:10] - for coin in recent_coins: - recent_coins[coin][value] /= 100 + for coin in range(len(recent_coins)): + recent_coins[coin].value /= 100 context = { 'countrys': countrys, 'users': users,