add feature /<countr.name_iso> now works :)
every coin gets fetched on its own which is sloww....
This commit is contained in:
parent
a070b7e97d
commit
683f926ed6
@ -54,7 +54,7 @@ class Country(Model):
|
|||||||
|
|
||||||
|
|
||||||
class Stamp(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)
|
name = CharField('Name', max_length=50)
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
<td class="{{ coin.kms }} {{ coin.rare }} {{ coin.noexist }} {{ coin.brass }}"><div class="{{ coin.found }} {{ coin.found_by }} {{ coin.ec }} {{ coin.check }}">{% if coin.found %}x{% endif %}</div></td>
|
<td class="{{ coin.kms }} {{ coin.rare }} {{ coin.noexist }} {{ coin.brass }}"><div class="{{ coin.found }} {{ coin.found_by }} {{ coin.ec }} {{ coin.check }}">{% if coin.found_by %}x{% endif %}</div></td>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
{% include "base.html" %}
|
||||||
|
{% block content %}
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -15,3 +17,4 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{% endblock %}
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
{% for stamp in year %}
|
{% for stamp in year %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="year"><div class="">{{ stamp }}{{ year_int }}</div></td>
|
<td class="year"><div class="">{{ stamp }}{{ year_int }}</div></td>
|
||||||
<td></td>
|
{% for value in values %}
|
||||||
<td></td>
|
{% show_coin country year_int stamp value %}
|
||||||
<td></td>
|
{% endfor %}
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% ifnotequal year|length 1 %}
|
{% ifnotequal year|length 1 %}
|
||||||
|
@ -27,5 +27,5 @@ app_name = 'coinc'
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.IndexView.as_view(), name='index'),
|
path('', views.IndexView.as_view(), name='index'),
|
||||||
path('statistik', views.statistic, name='statistic'),
|
path('statistik', views.statistic, name='statistic'),
|
||||||
path('<str:country>', views.DetailView.as_view(), name='country'),
|
path('<str:country>', views.detail_country, name='country'),
|
||||||
]
|
]
|
||||||
|
@ -39,10 +39,11 @@ class IndexView(generic.ListView):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DetailView(generic.DetailView):
|
def detail_country(request, country):
|
||||||
model = Country
|
template = loader.get_template('coinc/country.html')
|
||||||
template_name = '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')
|
@register.inclusion_tag('coinc/navigation.html')
|
||||||
@ -50,7 +51,6 @@ def show_navigation(countrys):
|
|||||||
return {'countrys': countrys}
|
return {'countrys': countrys}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag('coinc/country.html')
|
@register.inclusion_tag('coinc/country.html')
|
||||||
def show_country(country):
|
def show_country(country):
|
||||||
c = {
|
c = {
|
||||||
@ -63,10 +63,6 @@ def show_country(country):
|
|||||||
irregular_stamps = {}
|
irregular_stamps = {}
|
||||||
stamps = Stamp.objects.filter(country=country.name_iso).values(
|
stamps = Stamp.objects.filter(country=country.name_iso).values(
|
||||||
'name_short', 'years')
|
'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:
|
if stamps:
|
||||||
temp_stamps = {}
|
temp_stamps = {}
|
||||||
@ -108,8 +104,30 @@ def show_country(country):
|
|||||||
|
|
||||||
@register.inclusion_tag('coinc/year.html')
|
@register.inclusion_tag('coinc/year.html')
|
||||||
def show_year(country, year):
|
def show_year(country, year):
|
||||||
return { 'year': country['years'][year],
|
return {
|
||||||
'year_int': year }
|
'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
|
# TODO
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user