add original colors, move logic out of coin.html into views.py
This commit is contained in:
parent
83b59f4f04
commit
47a23da02c
@ -83,23 +83,31 @@ td > * {
|
||||
}
|
||||
|
||||
table > tbody > tr > td {
|
||||
background-color: lightgray;
|
||||
background-color: #b7b7b7;
|
||||
}
|
||||
|
||||
table > tbody > tr > td > div.coin {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
text-align: inherit;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
td.noexist {
|
||||
background-color: gray;
|
||||
background-color: #434343;
|
||||
}
|
||||
|
||||
td.brass {
|
||||
background-color: yellow;
|
||||
background-color: #ffff99;
|
||||
}
|
||||
|
||||
td.rare {
|
||||
background-color: brown;
|
||||
background-color: #e69138;
|
||||
}
|
||||
|
||||
td.kms {
|
||||
background-color: red;
|
||||
td.buy_only {
|
||||
background-color: #dd7e6b;
|
||||
}
|
||||
|
||||
td.year {
|
||||
@ -107,7 +115,7 @@ td.year {
|
||||
}
|
||||
|
||||
td.year-complete {
|
||||
background-color: green;
|
||||
background-color: #00ff00;
|
||||
}
|
||||
|
||||
td.spacer {
|
||||
@ -115,20 +123,24 @@ td.spacer {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
div.ec {
|
||||
color: red;
|
||||
td.in_collector {
|
||||
color: #ff0000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.check {
|
||||
color: green;
|
||||
td.checked {
|
||||
color: #00ff00;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.found {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height:30px;
|
||||
width:30px;
|
||||
clip-path: polygon(100% 70%, 100% 100%, 70% 100%);
|
||||
}
|
||||
|
||||
div.moritz {
|
||||
div.Moritz {
|
||||
background-color: red;
|
||||
}
|
||||
|
@ -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_by %}x{% endif %}</div></td>
|
||||
<td class="{{ td_class }}"><div class="coin">{{ marker }}<div class="{{ div_class }}"></div></div></td>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% for stamp in year %} <tr>
|
||||
<td class="year"><div class="">{{ stamp }}{{ year_int }}</div></td>
|
||||
{% for value in values %}{% show_coin country year_int stamp value %}{% endfor %} </tr>{% endfor %}{% ifnotequal year|length 1 %}
|
||||
<td class="year"><div class="">{{ stamp }}{{ year_short }}</div></td>
|
||||
{% for value in values %}{% show_coin country year_short stamp value %}{% endfor %} </tr>{% endfor %}{% ifnotequal year|length 1 %}
|
||||
<tr>
|
||||
<td class="spacer" colspan="12"></td>
|
||||
</tr>{% endifnotequal %}
|
||||
|
@ -86,17 +86,21 @@ def show_country(country):
|
||||
year_now = datetime.now().year
|
||||
for year in [str(i) for i in range(country.euro_member_since, year_now + 1)]:
|
||||
stamps_per_year = stamps
|
||||
|
||||
if irregular_stamps and year in irregular_stamps:
|
||||
for irregular_stamp, value in irregular_stamps[year].items():
|
||||
stamps_per_year[irregular_stamp] = {}
|
||||
|
||||
# TODO this is not really a fix...
|
||||
elif country.name_iso == 'gr':
|
||||
stamps_per_year = {'': {}}
|
||||
|
||||
y = year[2:4]
|
||||
c['years'][y] = {}
|
||||
year_short = year[2:4]
|
||||
c['years'][year_short] = {}
|
||||
|
||||
for stamp in stamps_per_year:
|
||||
c['years'][y][stamp] = {'name': stamp}
|
||||
c['years'][year_short][stamp] = {'name': stamp}
|
||||
|
||||
stamps_per_year = {}
|
||||
|
||||
return {'country': c}
|
||||
@ -107,7 +111,7 @@ def show_country(country):
|
||||
def show_year(country, year):
|
||||
return {
|
||||
'year': country['years'][year],
|
||||
'year_int': year,
|
||||
'year_short': year,
|
||||
'values': [1, 2, 5, 10, 20, 50, 100, 200, 201, 202, 203],
|
||||
'country': country['name_iso']
|
||||
}
|
||||
@ -121,15 +125,44 @@ def show_coin(country, year, stamp, value):
|
||||
@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')
|
||||
# TODO: fix this before the end of 2098
|
||||
year = int(year)
|
||||
if year == 99:
|
||||
year += 1900
|
||||
else:
|
||||
year += 2000
|
||||
|
||||
if coin:
|
||||
print(coin)
|
||||
if stamp == "":
|
||||
stamp = None
|
||||
|
||||
return { 'coin': coin }
|
||||
try:
|
||||
coin = Coin.objects.get(country=country, year=year, stamp=stamp, value=value)
|
||||
except Coin.DoesNotExist:
|
||||
return {}
|
||||
|
||||
if coin.buy_only:
|
||||
td_class = 'buy_only'
|
||||
elif coin.circulation and coin.circulation < 1500000:
|
||||
td_class = 'rare'
|
||||
elif coin.noexist:
|
||||
td_class = 'noexist'
|
||||
elif coin.value in [10, 20, 50]:
|
||||
td_class = 'brass'
|
||||
|
||||
if coin.in_collector:
|
||||
td_class += ' in_collector'
|
||||
elif coin.checked:
|
||||
td_class += ' coin_checked'
|
||||
|
||||
if coin.found_by:
|
||||
div_class = f"found {coin.found_by}"
|
||||
marker = 'x'
|
||||
|
||||
return {
|
||||
'marker': marker,
|
||||
'td_class': td_class,
|
||||
'div_class': div_class,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user