Show current-year school holidays and add Bristol source link
Closes #209 Closes #210
This commit is contained in:
parent
1397805450
commit
016039e78f
2 changed files with 8 additions and 2 deletions
|
|
@ -21,7 +21,10 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>UK school holidays (Bristol)</h2>
|
<h2>
|
||||||
|
UK school holidays (Bristol)
|
||||||
|
<small class="fs-6 ms-2"><a href="{{ school_holiday_page_url }}">source</a></small>
|
||||||
|
</h2>
|
||||||
<table class="table table-hover w-auto">
|
<table class="table table-hover w-auto">
|
||||||
{% for item in school_holidays %}
|
{% for item in school_holidays %}
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import agenda.stats
|
||||||
import agenda.thespacedevs
|
import agenda.thespacedevs
|
||||||
import agenda.trip
|
import agenda.trip
|
||||||
import agenda.trip_schengen
|
import agenda.trip_schengen
|
||||||
|
import agenda.uk_school_holiday
|
||||||
import agenda.utils
|
import agenda.utils
|
||||||
import agenda.weather
|
import agenda.weather
|
||||||
from agenda import ical, calendar, format_list_with_ampersand, travel, uk_tz
|
from agenda import ical, calendar, format_list_with_ampersand, travel, uk_tz
|
||||||
|
|
@ -885,10 +886,11 @@ def holiday_list() -> str:
|
||||||
"""List of holidays."""
|
"""List of holidays."""
|
||||||
today = date.today()
|
today = date.today()
|
||||||
data_dir = app.config["DATA_DIR"]
|
data_dir = app.config["DATA_DIR"]
|
||||||
|
year_start = date(today.year, 1, 1)
|
||||||
next_year = today + timedelta(days=1 * 365)
|
next_year = today + timedelta(days=1 * 365)
|
||||||
items = agenda.holidays.get_all(today - timedelta(days=2), next_year, data_dir)
|
items = agenda.holidays.get_all(today - timedelta(days=2), next_year, data_dir)
|
||||||
school_holidays = agenda.holidays.get_school_holidays(
|
school_holidays = agenda.holidays.get_school_holidays(
|
||||||
today - timedelta(days=2), next_year, data_dir
|
year_start, next_year, data_dir
|
||||||
)
|
)
|
||||||
|
|
||||||
items.sort(key=lambda item: (item.date, item.country))
|
items.sort(key=lambda item: (item.date, item.country))
|
||||||
|
|
@ -898,6 +900,7 @@ def holiday_list() -> str:
|
||||||
"holiday_list.html",
|
"holiday_list.html",
|
||||||
items=items,
|
items=items,
|
||||||
school_holidays=school_holidays,
|
school_holidays=school_holidays,
|
||||||
|
school_holiday_page_url=agenda.uk_school_holiday.school_holiday_page_url,
|
||||||
get_country=agenda.get_country,
|
get_country=agenda.get_country,
|
||||||
today=today,
|
today=today,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue