forked from expo/troggle
Fixed cave sort-order in cave index
This commit is contained in:
parent
16ef4fa9fb
commit
49277216ba
@ -69,14 +69,18 @@ def padnumber(x):
|
|||||||
def numericalcmp(x, y):
|
def numericalcmp(x, y):
|
||||||
return cmp(padnumber(x), padnumber(y))
|
return cmp(padnumber(x), padnumber(y))
|
||||||
|
|
||||||
def caveKey(x):
|
def caveKey(c):
|
||||||
"""python3 function for sort. Done in a hurry.
|
"""This function goes into a lexicogrpahic sort function, and the values are strings,
|
||||||
Note that cave kataster numbers are not always integers.
|
but we want to sort numberically on kataster number before sorting on unofficial number.
|
||||||
This needs to be fixed make a decent sort order.
|
|
||||||
"""
|
"""
|
||||||
if not x.kataster_number:
|
if not c.kataster_number:
|
||||||
return "~"
|
return "9999." + c.unofficial_number
|
||||||
return x.kataster_number
|
else:
|
||||||
|
if int(c.kataster_number) >= 100:
|
||||||
|
return "99." + c.kataster_number
|
||||||
|
if int(c.kataster_number) >= 10:
|
||||||
|
return "9." + c.kataster_number
|
||||||
|
return c.kataster_number
|
||||||
|
|
||||||
def getnotablecaves():
|
def getnotablecaves():
|
||||||
notablecaves = []
|
notablecaves = []
|
||||||
|
@ -17,20 +17,22 @@
|
|||||||
|
|
||||||
<h3>1626</h3>
|
<h3>1626</h3>
|
||||||
|
|
||||||
<ul class="searchable">
|
<div style="column-count: 2;">
|
||||||
{% for cave in caves1626 %}
|
<table class="searchable">
|
||||||
|
{% for cave in caves1626 %}
|
||||||
<li> <a href="{{ cave.url }}">{% if cave.kataster_number %}{{ cave.kataster_number }} {{cave.official_name|safe}}</a> {% if cave.unofficial_number %}({{cave.unofficial_number }}){% endif %}{% else %}{{cave.unofficial_number }} {{cave.official_name|safe}}</a> {% endif %}
|
<tr><td><a href="{{ cave.url }}">{% if cave.kataster_number %}{{ cave.kataster_number }} {{cave.official_name|safe}}</a> {% if cave.unofficial_number %}({{cave.unofficial_number }}){% endif %}{% else %}{{cave.unofficial_number }} {{cave.official_name|safe}}</a> {% endif %} </td></tr>
|
||||||
</li>
|
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p style="text-align:right">
|
<p style="text-align:right">
|
||||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||||
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
<a href="/noinfo/cave-number-index">Cave Number Index - kept updated</a>
|
||||||
</p>
|
</p>
|
||||||
<h3>1623</h3>
|
<h3>1623</h3>
|
||||||
|
|
||||||
|
<div style="column-count: 3;">
|
||||||
<table class="searchable">
|
<table class="searchable">
|
||||||
{% for cave in caves1623 %}
|
{% for cave in caves1623 %}
|
||||||
|
|
||||||
@ -38,6 +40,7 @@
|
|||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p style="text-align:right">
|
<p style="text-align:right">
|
||||||
<a href="{% url "newcave" %}">New Cave</a><br>
|
<a href="{% url "newcave" %}">New Cave</a><br>
|
||||||
|
Loading…
Reference in New Issue
Block a user