From 2f9c9539dbc4c1cf03a60ed0308ab7b9de6a393b Mon Sep 17 00:00:00 2001 From: koksnuss Date: Wed, 22 Apr 2020 11:18:50 +0200 Subject: [PATCH] fill out euro_member_since to db; add iterate through countrys and years --- coinmanager/coinc/templates/coinc/index.html | 57 +++++++++++++ coinmanager/coinc/views.py | 82 ++++++++++++++++++- coinmanager/db.sqlite3 | Bin 163840 -> 163840 bytes 3 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 coinmanager/coinc/templates/coinc/index.html diff --git a/coinmanager/coinc/templates/coinc/index.html b/coinmanager/coinc/templates/coinc/index.html new file mode 100644 index 0000000..b22ea36 --- /dev/null +++ b/coinmanager/coinc/templates/coinc/index.html @@ -0,0 +1,57 @@ + + + + + + Münzsammlung + + {% if countrys %} {% for country in countrys %} + + + + + + + + {% for year in countrys|years:country %} + + {% comment %} + {% for col in row.cols %} + + {% endfor %} + + + + + + + {% endcomment %} + {% endfor %} + +
{{ countrys|name:country }} + x €
{{ year }}{{ col.x }}{% col.special1_name %}{% col.special1_x %}{% col.special2_name %}{% col.special2_x %}{% col.special3_name %}{% col.special3_x %}
{% endfor %} {% else %} +

Trage zuerst Länder im Adminbereich ein.

{% endif %} + + diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py index 1f6ddc3..b01dd54 100644 --- a/coinmanager/coinc/views.py +++ b/coinmanager/coinc/views.py @@ -15,14 +15,90 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# +# +# Views +# - / +# coinc Homepage: Übersicht wie in der Tabelle +# Template: index.? lädt country.? nach und ermöglicht Filtern danach +# +# - / kann 'de' oder 'deutschland' sein +# Landesansicht: Zeige nur ein Land wie in der Übersicht +# Template: country.? +# - Urlaubsansicht /?urlaub +# Ansicht von einem Land, wobei nur die Münzen, die Fehlen hervorgehoben werden +# +# - /statistik +# Statistik: zeige Statistiken, z.B. Anwachsen der Münzen über die Zeit/Länder/etc. +# Template: statistik.? +# +# - /admin +# Adminbereich: Füge neue Länder hinzu +# Template: bereits vorhanden -from django.shortcuts import render - from django.http import HttpResponse +from django.template import loader +from django.template.defaultfilters import register +from .models import Country + + + +@register.filter(name='name') +def name(countrys, name_iso): + return countrys[name_iso]['name'] + + +@register.filter(name='years') +def years(countrys, name_iso): + return countrys[name_iso]['years'] def index(request): - return HttpResponse("loift") + c = Country.objects.order_by('name') + + template = loader.get_template('coinc/index.html') + countrys = {} + import json + from datetime import datetime + year_now = datetime.now().year + + for country in c: + countrys[country.name_iso] = { + 'name': country.name, + 'comment': country.comment, + 'euro_member_since': country.euro_member_since, + 'years': {} + } + + for year in range(country.euro_member_since, year_now + 1): + countrys[country.name_iso]['years'][year] = { + '1': 1, + '2': 2, + '5': 5, + '10': 10, + '20': 20, + '50': 50, + '100': 100, + '200': 200, + '200_1_name': 'name 1', + '200_1': 200, + '200_2_name': 'name 2', + '200_2': 200, + '200_3_name': 'name 3', + '200_3': 200 + } + + context = { 'countrys': countrys } + print(json.dumps(context, indent=4)) + return HttpResponse(template.render(context, request)) + + +def country(request, country): + return HttpResponse(f"Land: {country}") + + +def statistic(request): + return HttpResponse('Statistik') diff --git a/coinmanager/db.sqlite3 b/coinmanager/db.sqlite3 index a1780d95fd207532d089a3d901481ec46c365b86..e395e3f8af2d5469ebd46ddc4bfa9221e2fb4346 100644 GIT binary patch delta 3916 zcmb`KU2Ggz702h!dNTILGk2#>oH~i^_1a#q9eaG|YiDK)1qa&1)W&U0i9|l|#5-P( zc0D$`v)h!Y+H47ZDpB&n^et3KynrB9EBx3(ROg$3h18&iHUeJg3m+0v)fS0+uU!i2 zE;de9@^9C(_n!Yf=bn4+*|TS(XU|42>=TYN43olt^mQ?1g5%3G?C1_-4;Rru__u?g z?X@$bUt5xtxTfaUix}ctA^!tl>hKtR7EZx&_$ByxXhH=Z zfc>x=cEC0$Kpq0|Bk>>NU&KF)e-wW&zAgSnyeYo5T$>iFTm*oKL8((}lq#h{i6}=Y zWy%rCVafxPLzIJ*DarxLBxOHkA7w9Pg0h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