{% macro display_datetime(dt) %}{{ dt.strftime("%a, %d, %b %Y %H:%M %z") }}{% endmacro %} {% macro display_time(dt) %} {% if dt %}{{ dt.strftime("%H:%M %z") }}{% endif %} {% endmacro %} {% macro display_date(dt) %}{{ dt.strftime("%a %-d %b %Y") }}{% endmacro %} {% macro display_date_no_year(dt) %}{{ dt.strftime("%a %-d %b") }}{% endmacro %} {% macro format_distance(distance) %} {{ "{:,.0f} km / {:,.0f} miles".format(distance, distance / 1.60934) }} {% endmacro %} {% macro trip_link(trip) %} {{ trip.title }} {% endmacro %} {% macro conference_row(item, badge, show_flags=True) %} {% set country = get_country(item.country) if item.country else None %}
{{ item.start.strftime("%a, %d %b %Y") }}
{{ item.end.strftime("%a, %d %b") }}
{% if item.url %} {{ item.name }} {% else %} {{ item.name }} {% endif %} {% if item.going and not (item.accommodation_booked or item.travel_booked) %} {{ badge }} {% endif %} {% if item.accommodation_booked %} accommodation {% endif %} {% if item.transport_booked %} transport {% endif %}
{% if item.price and item.currency %} {{ "{:,d}".format(item.price | int) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% elif item.free %} free to attend {% endif %}
{{ item.topic }}
{{ item.location }}
{{ display_date(item.cfp_end) if item.cfp_end else "" }}
{% if country %} {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }} {% elif item.online %} 💻 Online {% else %} country code {{ item.country }} not found {% endif %}
{% endmacro %} {% macro accommodation_row(item, badge, show_flags=True) %} {% set country = get_country(item.country) %} {% set nights = (item.to.date() - item.from.date()).days %}
{{ item.from.strftime("%a, %d %b %Y") }}
{{ item.to.strftime("%a, %d %b") }}
{% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %}
{{ item.operator }}
{{ item.location }}
{% if country %} {% if show_flags %}{{ country.flag }}{% endif %} {{ country.name }} {% else %} country code {{ item.country }} not found {% endif %}
{% if g.user.is_authenticated and item.url %} {{ item.name }} {% else %} {{ item.name }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro flight_booking_row(booking, show_flags=True) %}
{% if g.user.is_authenticated %} {{ booking.booking_reference or "reference missing" }} {% else %} redacted {% endif %}
{% if g.user.is_authenticated and booking.price and booking.currency %} {{ "{:,f}".format(booking.price) }} {{ booking.currency }} {% if booking.currency != "GBP" %} {{ "{:,.2f}".format(booking.price / fx_rate[booking.currency]) }} GBP {% endif %} {% endif %}
{% for i in range(8) %}
{% endfor %} {% for item in booking.flights %} {% set full_flight_number = item.airline + item.flight_number %} {% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} → {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.duration }}
{{ full_flight_number }}
flightradar24 | FlightAware | radarbox
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% endfor %} {% endmacro %} {% macro flight_row(item) %} {% set full_flight_number = item.airline + item.flight_number %} {% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} → {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.duration }}
{{ full_flight_number }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
flightradar24 | FlightAware | radarbox
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro train_row(item) %} {% set url = item.url %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{% if g.user.is_authenticated and item.url %}{% endif %} {{ item.from }} → {{ item.to }} {% if g.user.is_authenticated and item.url %}{% endif %}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ ((item.arrive - item.depart).total_seconds() // 60) | int }} mins
{{ item.operator }}
{% if g.user.is_authenticated %} {{ item.booking_reference }} {% else %} redacted {% endif %}
{% for leg in item.legs %} {% if leg.url %} [{{ loop.index }}] {% endif %} {% endfor %}
{% if item.distance %} {{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }} {% endif %}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" and item.currency in fx_rate %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{% endmacro %} {% macro ferry_row(item) %}
{{ item.depart.strftime("%a, %d %b %Y") }}
{{ item.from }} → {{ item.to }}
{{ item.depart.strftime("%H:%M") }}
{% if item.arrive %} {{ item.arrive.strftime("%H:%M") }} {% if item.depart != item.arrive and item.arrive.date() != item.depart.date() %}+1 day{% endif %} {% endif %}
{{ item.operator }}
{% if g.user.is_authenticated and item.price and item.currency %} {{ "{:,f}".format(item.price) }} {{ item.currency }} {% if item.currency != "GBP" %} {{ "{:,.2f}".format(item.price / fx_rate[item.currency]) }} GBP {% endif %} {% endif %}
{#
{{ item | pprint }}
#} {% endmacro %}