year range in settings file

This commit is contained in:
crunk 2024-04-22 20:59:26 +02:00
parent f5632ccfd2
commit e824430d95
2 changed files with 13 additions and 12 deletions

View File

@ -23,6 +23,17 @@ class UploadForm(FlaskForm):
categories.append((config_category, config_category)) categories.append((config_category, config_category))
return categories return categories
def year_choices():
APP = settings()
start_time = APP.config["start_time"]
end_time = APP.config["end_time"]
year_range = range(start_time.year, end_time.year, 1)
year_choices = []
for year in year_range:
year_choices.append((str(year), str(year)))
return year_choices
sitename = StringField( sitename = StringField(
"Name of your archive section:", "Name of your archive section:",
validators=[ validators=[
@ -35,17 +46,7 @@ class UploadForm(FlaskForm):
"Year:", "Year:",
validate_choice=True, validate_choice=True,
coerce=str, coerce=str,
choices=[ choices=year_choices,
("2017", "2017"),
("2018", "2018"),
("2019", "2019"),
("2020", "2020"),
("2021", "2021"),
("2022", "2022"),
("2023", "2023"),
("2024", "2024"),
("2025", "2025"),
],
option_widget=None, option_widget=None,
validators=[DataRequired()], validators=[DataRequired()],
) )

View File

@ -1,4 +1,4 @@
title = "Varia Archive X Distribusi-Verse" title = "Varia Archive X Distribusi-Verse"
categories = ["event","gathering","work session","workgroup","performance","music event"] categories = ["event","gathering","work session","workgroup","performance","music event"]
start_time = 2017-11-03 start_time = 2017-11-03
end_time = 2024-12-31 end_time = 2025-12-31