kopia lustrzana https://github.com/glidernet/ogn-python
Use cached airport list
rodzic
9e56bc7844
commit
5f50d33cdf
|
@ -127,9 +127,7 @@ def airports():
|
||||||
countries = get_countries_in_logbook()
|
countries = get_countries_in_logbook()
|
||||||
|
|
||||||
if sel_country:
|
if sel_country:
|
||||||
airports = db.session.query(Airport) \
|
airports = get_airports_in_country(sel_country)
|
||||||
.filter(Airport.country_code == sel_country) \
|
|
||||||
.order_by(Airport.name)
|
|
||||||
else:
|
else:
|
||||||
airports = []
|
airports = []
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
{% for airport in airports %}
|
{% for airport in airports %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ loop.index }}
|
<td>{{ loop.index }}
|
||||||
<td><img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ airport.country_code|lower }}" alt="{{ airport.country_code }}"/> <a href="{{ url_for('airport_detail', airport=airport.id) }}">{{ airport.name }}</a></td>
|
<td><img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ sel_country|lower }}" alt="{{ sel_country }}"/> <a href="{{ url_for('airport_detail', airport=airport.id) }}">{{ airport.name }}</a></td>
|
||||||
<td><a href="{{ url_for('logbook', airport=airport.id) }}">Logbook</a></td>
|
<td><a href="{{ url_for('logbook', country=sel_country, airport=airport.id) }}">Logbook</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
<td>{% if entry.duration is not none %}{{ entry.duration }}{% endif %}</td>
|
<td>{% if entry.duration is not none %}{{ entry.duration }}{% endif %}</td>
|
||||||
<td>{% if entry.max_altitude is not none %}{{ '%0.1f'|format(entry.max_altitude - entry.takeoff_airport.altitude) }} m{% endif %}</td>
|
<td>{% if entry.max_altitude is not none %}{{ '%0.1f'|format(entry.max_altitude - entry.takeoff_airport.altitude) }} m{% endif %}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if entry.takeoff_airport is not none and entry.takeoff_airport.id != sel_airport %}Take Off: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.takeoff_airport.country_code|lower }}" alt="{{ entry.takeoff_airport.country_code }}"/> <a href="{{ url_for('logbook', airport=entry.takeoff_airport.id) }}">{{ entry.takeoff_airport.name }}</a>
|
{% if entry.takeoff_airport is not none and entry.takeoff_airport.id != sel_airport %}Take Off: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.takeoff_airport.country_code|lower }}" alt="{{ entry.takeoff_airport.country_code }}"/> <a href="{{ url_for('logbook', country=entry.takeoff_airport.country_code, airport=entry.takeoff_airport.id, date=sel_date) }}">{{ entry.takeoff_airport.name }}</a>
|
||||||
{% elif entry.landing_airport is not none and entry.landing_airport.id != sel_airport %}Landing: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.landing_airport.country_code|lower }}" alt="{{ entry.landing_airport.country_code }}"/> <a href="{{ url_for('logbook', airport=entry.landing_airport.id) }}">{{ entry.landing_airport.name }}</a>
|
{% elif entry.landing_airport is not none and entry.landing_airport.id != sel_airport %}Landing: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.landing_airport.country_code|lower }}" alt="{{ entry.landing_airport.country_code }}"/> <a href="{{ url_for('logbook', country=entry.takeoff_airport.country_code, airport=entry.landing_airport.id, date=sel_date) }}">{{ entry.landing_airport.name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Ładowanie…
Reference in New Issue