diff --git a/coinmanager/coinc/models.py b/coinmanager/coinc/models.py
index 735f70a..411ec46 100644
--- a/coinmanager/coinc/models.py
+++ b/coinmanager/coinc/models.py
@@ -54,7 +54,7 @@ class Country(Model):
class Stamp(Model):
- name_short = CharField('Prägung', max_length=10)
+ name_short = CharField('Prägung', max_length=10, primary_key=True)
name = CharField('Name', max_length=50)
diff --git a/coinmanager/coinc/templates/coinc/coin.html b/coinmanager/coinc/templates/coinc/coin.html
index fa72b40..3a5113c 100644
--- a/coinmanager/coinc/templates/coinc/coin.html
+++ b/coinmanager/coinc/templates/coinc/coin.html
@@ -1 +1 @@
-
{% if coin.found %}x{% endif %} |
+ {% if coin.found_by %}x{% endif %} |
diff --git a/coinmanager/coinc/templates/coinc/country.html b/coinmanager/coinc/templates/coinc/country.html
index b4aa8d6..a1c72b3 100644
--- a/coinmanager/coinc/templates/coinc/country.html
+++ b/coinmanager/coinc/templates/coinc/country.html
@@ -1,3 +1,5 @@
+ {% include "base.html" %}
+ {% block content %}
@@ -15,3 +17,4 @@
{% endfor %}
+ {% endblock %}
diff --git a/coinmanager/coinc/templates/coinc/year.html b/coinmanager/coinc/templates/coinc/year.html
index e842c2a..f6bde03 100644
--- a/coinmanager/coinc/templates/coinc/year.html
+++ b/coinmanager/coinc/templates/coinc/year.html
@@ -1,17 +1,9 @@
{% for stamp in year %}
{{ stamp }}{{ year_int }} |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
+ {% for value in values %}
+ {% show_coin country year_int stamp value %}
+ {% endfor %}
{% endfor %}
{% ifnotequal year|length 1 %}
diff --git a/coinmanager/coinc/urls.py b/coinmanager/coinc/urls.py
index f49c441..9da2336 100644
--- a/coinmanager/coinc/urls.py
+++ b/coinmanager/coinc/urls.py
@@ -27,5 +27,5 @@ app_name = 'coinc'
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('statistik', views.statistic, name='statistic'),
- path('', views.DetailView.as_view(), name='country'),
+ path('', views.detail_country, name='country'),
]
diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py
index 2c532dd..def3459 100644
--- a/coinmanager/coinc/views.py
+++ b/coinmanager/coinc/views.py
@@ -39,10 +39,11 @@ class IndexView(generic.ListView):
-class DetailView(generic.DetailView):
- model = Country
- template_name = 'coinc/country.html'
-
+def detail_country(request, country):
+ template = loader.get_template('coinc/country.html')
+ c = Country.objects.get(name_iso=country)
+ return HttpResponse(template.render(show_country(c), request))
+# return HttpResponse(template.render("foo", request))
@register.inclusion_tag('coinc/navigation.html')
@@ -50,7 +51,6 @@ def show_navigation(countrys):
return {'countrys': countrys}
-
@register.inclusion_tag('coinc/country.html')
def show_country(country):
c = {
@@ -63,10 +63,6 @@ def show_country(country):
irregular_stamps = {}
stamps = Stamp.objects.filter(country=country.name_iso).values(
'name_short', 'years')
- coins = Coin.objects.filter(country=country.name_iso).values(
- 'value', 'year', 'stamp', 'name', 'found_by',
- 'found_on', 'buy_only', 'circulation', 'comment',
- 'in_collector', 'checked', 'exists')
if stamps:
temp_stamps = {}
@@ -108,8 +104,30 @@ def show_country(country):
@register.inclusion_tag('coinc/year.html')
def show_year(country, year):
- return { 'year': country['years'][year],
- 'year_int': year }
+ return {
+ 'year': country['years'][year],
+ 'year_int': year,
+ 'values': [1, 2, 5, 10, 20, 50, 100, 200, 201, 202, 203],
+ 'country': country['name_iso']
+ }
+
+
+@register.inclusion_tag('coinc/coin.html')
+def show_coin(country, year, stamp, value):
+ ''' @param country: Country.name_iso
+ @param year: int YYYY
+ @param stamp: stamp_id
+ @param value: int e [1,2,5,10,20,50,100,200,201,202,203]
+ '''
+ coin = Coin.objects.filter(country=country, year=year, stamp=stamp, value=value).values(
+ 'value', 'year', 'stamp', 'name', 'found_by',
+ 'found_on', 'buy_only', 'circulation', 'comment',
+ 'in_collector', 'checked', 'exists')
+
+ if coin:
+ print(coin)
+
+ return { 'coin': coin }
# TODO
diff --git a/coinmanager/db.sqlite3 b/coinmanager/db.sqlite3
index ebae7ae..6f372e6 100644
Binary files a/coinmanager/db.sqlite3 and b/coinmanager/db.sqlite3 differ