Merge branch 'master' of ssh://willipink.eu:3456/moritz/coinmanager into HEAD
This commit is contained in:
commit
fc790c178f
@ -1,6 +1,6 @@
|
|||||||
# Roadmap
|
# Roadmap
|
||||||
- [x] Prototype
|
- [x] Prototype
|
||||||
- [ ] Milestone [1.0 Happy Birthday](https://willipink.eu/git/moritz/coinmanager/milestone/23)
|
- [x] Milestone [1.0 Happy Birthday](https://willipink.eu/git/moritz/coinmanager/milestone/23)
|
||||||
- [ ] Milestone [2.0 Nice to have](https://willipink.eu/git/moritz/coinmanager/milestone/24)
|
- [ ] Milestone [2.0 Nice to have](https://willipink.eu/git/moritz/coinmanager/milestone/24)
|
||||||
- [ ] Add statistics [#5](https://willipink.eu/git/moritz/coinmanager/issues/5)
|
- [ ] Add statistics [#5](https://willipink.eu/git/moritz/coinmanager/issues/5)
|
||||||
- [ ] Add search function [#8](https://willipink.eu/git/moritz/coinmanager/issues/8)
|
- [ ] Add search function [#8](https://willipink.eu/git/moritz/coinmanager/issues/8)
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
{% for stamp in year %} <tr name="{{ year_short }}" stamp="{{ stamp }}">
|
{% for stamp, coins in stamps.items %}
|
||||||
<td class="year {{ year_complete }}"><div class="coin">{{ stamp }}{{ year_short }}</div></td>
|
<tr name="{{ year_short }}" stamp="{{ stamp }}">
|
||||||
{% for value in values %}{% show_coin country year_short stamp value %}{% endfor %} </tr>{% endfor %}{% ifnotequal year|length 1 %}
|
<td class="year {{ year_complete }}">
|
||||||
<tr>
|
<div class="coin">{{ stamp }}{{ year_short }}</div>
|
||||||
<td class="spacer" colspan="12"></td>
|
</td>
|
||||||
</tr>{% endifnotequal %}
|
{% for value, coin in coins.items %}
|
||||||
|
{% show_coin coin value %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% ifnotequal stamps|length 1 %}
|
||||||
|
<tr>
|
||||||
|
<td class="spacer" colspan="12"></td>
|
||||||
|
</tr>
|
||||||
|
{% endifnotequal %}
|
||||||
|
@ -90,6 +90,7 @@ def show_country(country, single_country=False):
|
|||||||
'comment': country.comment,
|
'comment': country.comment,
|
||||||
'years': {}
|
'years': {}
|
||||||
}
|
}
|
||||||
|
coin_sum = coin_sum_of_(country)
|
||||||
|
|
||||||
irregular_stamps = {}
|
irregular_stamps = {}
|
||||||
stamps = Stamp.objects.filter(country=country.name_iso).values(
|
stamps = Stamp.objects.filter(country=country.name_iso).values(
|
||||||
@ -125,15 +126,79 @@ def show_country(country, single_country=False):
|
|||||||
elif country.name_iso == 'gr':
|
elif country.name_iso == 'gr':
|
||||||
stamps_per_year = {'': {}}
|
stamps_per_year = {'': {}}
|
||||||
|
|
||||||
year_short = year[2:4]
|
c['years'][year] = {}
|
||||||
c['years'][year_short] = {}
|
|
||||||
|
|
||||||
for stamp in stamps_per_year:
|
for stamp in stamps_per_year:
|
||||||
c['years'][year_short][stamp] = {'name': stamp}
|
c['years'][year][stamp] = {
|
||||||
|
1: {},
|
||||||
|
2: {},
|
||||||
|
5: {},
|
||||||
|
10: {},
|
||||||
|
20: {},
|
||||||
|
50: {},
|
||||||
|
100: {},
|
||||||
|
200: {},
|
||||||
|
201: {},
|
||||||
|
202: {},
|
||||||
|
203: {}
|
||||||
|
}
|
||||||
|
|
||||||
stamps_per_year = {}
|
stamps_per_year = {}
|
||||||
|
|
||||||
coin_sum = coin_sum_of_(country)
|
coins = Coin.objects.all().filter(country=country)
|
||||||
|
for coin in coins:
|
||||||
|
|
||||||
|
td_class = ''
|
||||||
|
if not coin.exists:
|
||||||
|
td_class = 'noexist'
|
||||||
|
elif coin.buy_only:
|
||||||
|
td_class = 'buy_only'
|
||||||
|
elif coin.circulation and coin.circulation <= 1500000:
|
||||||
|
td_class = 'rare'
|
||||||
|
elif coin.value in [10, 20, 50]:
|
||||||
|
td_class = 'brass'
|
||||||
|
elif coin.found_by:
|
||||||
|
td_class = 'found'
|
||||||
|
else:
|
||||||
|
td_class = 'exist'
|
||||||
|
|
||||||
|
if coin.in_collector:
|
||||||
|
td_class += ' ec'
|
||||||
|
elif coin.checked:
|
||||||
|
td_class += ' checked'
|
||||||
|
|
||||||
|
div_class = ''
|
||||||
|
marker = ''
|
||||||
|
if coin.found_by:
|
||||||
|
div_class = f"found {coin.found_by}"
|
||||||
|
marker = '✔'
|
||||||
|
|
||||||
|
name = coin.name if coin.name else ''
|
||||||
|
special_class = ''
|
||||||
|
special_name = ''
|
||||||
|
if name:
|
||||||
|
if coin.value == 201:
|
||||||
|
special_name = 'special1_name'
|
||||||
|
elif coin.value == 202:
|
||||||
|
special_name = 'special2_name'
|
||||||
|
elif coin.value == 203:
|
||||||
|
special_name = 'special3_name'
|
||||||
|
|
||||||
|
if len(name) >= 18 and len(name) <= 42:
|
||||||
|
special_class = 'two_lines'
|
||||||
|
elif len(name) > 42:
|
||||||
|
special_class = 'three_lines'
|
||||||
|
|
||||||
|
stamp = coin.stamp.name_short if coin.stamp else ''
|
||||||
|
|
||||||
|
c['years'][str(coin.year)][stamp][coin.value] = {
|
||||||
|
'marker': marker,
|
||||||
|
'name': name,
|
||||||
|
'td_class': td_class,
|
||||||
|
'div_class': div_class,
|
||||||
|
'special_class': special_class,
|
||||||
|
'special_name': special_name
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'country': c,
|
'country': c,
|
||||||
@ -146,94 +211,27 @@ def show_country(country, single_country=False):
|
|||||||
@register.inclusion_tag('coinc/year.html')
|
@register.inclusion_tag('coinc/year.html')
|
||||||
def show_year(country, year):
|
def show_year(country, year):
|
||||||
''' show a year '''
|
''' show a year '''
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'year': country['years'][year],
|
'stamps': country['years'][year],
|
||||||
'year_short': year,
|
'year_short': year[2:4],
|
||||||
'values': [1, 2, 5, 10, 20, 50, 100, 200, 201, 202, 203],
|
|
||||||
'country': country['name_iso']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag('coinc/coin.html')
|
@register.inclusion_tag('coinc/coin.html')
|
||||||
def show_coin(country, year, stamp, value):
|
def show_coin(coin, value):
|
||||||
''' show a coin
|
''' show a coin '''
|
||||||
@param country: Country.name_iso
|
if coin:
|
||||||
@param year: int YYYY
|
|
||||||
@param stamp: stamp_id
|
|
||||||
@param value: int e [1,2,5,10,20,50,100,200,201,202,203]
|
|
||||||
'''
|
|
||||||
year = int(year) # TODO fix this before the end of 2098
|
|
||||||
if year == 99:
|
|
||||||
year += 1900
|
|
||||||
else:
|
|
||||||
year += 2000
|
|
||||||
|
|
||||||
if stamp == "":
|
|
||||||
stamp = None
|
|
||||||
|
|
||||||
try:
|
|
||||||
coin = Coin.objects.get(country=country, year=year, stamp=stamp, value=value)
|
|
||||||
except Coin.DoesNotExist:
|
|
||||||
return {
|
|
||||||
'value': value
|
|
||||||
}
|
|
||||||
except Coin.MultipleObjectsReturned:
|
|
||||||
return {
|
return {
|
||||||
'value': value,
|
'value': value,
|
||||||
'marker': 'Fehler!'
|
'marker': coin['marker'],
|
||||||
|
'name': coin['name'],
|
||||||
|
'td_class': coin['td_class'],
|
||||||
|
'div_class': coin['div_class'],
|
||||||
|
'special_class': coin['special_class'],
|
||||||
|
'special_name': coin['special_name'],
|
||||||
}
|
}
|
||||||
|
|
||||||
td_class = ''
|
|
||||||
if not coin.exists:
|
|
||||||
td_class = 'noexist'
|
|
||||||
elif coin.buy_only:
|
|
||||||
td_class = 'buy_only'
|
|
||||||
elif coin.circulation and coin.circulation <= 1500000:
|
|
||||||
td_class = 'rare'
|
|
||||||
elif coin.value in [10, 20, 50]:
|
|
||||||
td_class = 'brass'
|
|
||||||
elif coin.found_by:
|
|
||||||
td_class = 'found'
|
|
||||||
else:
|
else:
|
||||||
td_class = 'exist'
|
return {}
|
||||||
|
|
||||||
if coin.in_collector:
|
|
||||||
td_class += ' ec'
|
|
||||||
elif coin.checked:
|
|
||||||
td_class += ' checked'
|
|
||||||
|
|
||||||
div_class = ''
|
|
||||||
marker = ''
|
|
||||||
if coin.found_by:
|
|
||||||
div_class = f"found {coin.found_by}"
|
|
||||||
marker = '✔'
|
|
||||||
|
|
||||||
name = coin.name if coin.name else ''
|
|
||||||
special_class = ''
|
|
||||||
special_name = ''
|
|
||||||
if name:
|
|
||||||
if value == 201:
|
|
||||||
special_name = 'special1_name'
|
|
||||||
elif value == 202:
|
|
||||||
special_name = 'special2_name'
|
|
||||||
elif value == 203:
|
|
||||||
special_name = 'special3_name'
|
|
||||||
|
|
||||||
if len(name) >= 18 and len(name) <= 42:
|
|
||||||
special_class = 'two_lines'
|
|
||||||
elif len(name) > 42:
|
|
||||||
special_class = 'three_lines'
|
|
||||||
|
|
||||||
return {
|
|
||||||
'value': value,
|
|
||||||
'marker': marker,
|
|
||||||
'name': name,
|
|
||||||
'td_class': td_class,
|
|
||||||
'div_class': div_class,
|
|
||||||
'special_class': special_class,
|
|
||||||
'special_name': special_name
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def add_user(request, username, color):
|
def add_user(request, username, color):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user