From e824430d952c396dfc5ec1f291ea96b8851e94fc Mon Sep 17 00:00:00 2001 From: crunk Date: Mon, 22 Apr 2024 20:59:26 +0200 Subject: [PATCH] year range in settings file --- verse/forms/uploadform.py | 23 ++++++++++++----------- verse/settings.toml | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/verse/forms/uploadform.py b/verse/forms/uploadform.py index 1c952e5..3d47e72 100644 --- a/verse/forms/uploadform.py +++ b/verse/forms/uploadform.py @@ -23,6 +23,17 @@ class UploadForm(FlaskForm): categories.append((config_category, config_category)) 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( "Name of your archive section:", validators=[ @@ -35,17 +46,7 @@ class UploadForm(FlaskForm): "Year:", validate_choice=True, coerce=str, - choices=[ - ("2017", "2017"), - ("2018", "2018"), - ("2019", "2019"), - ("2020", "2020"), - ("2021", "2021"), - ("2022", "2022"), - ("2023", "2023"), - ("2024", "2024"), - ("2025", "2025"), - ], + choices=year_choices, option_widget=None, validators=[DataRequired()], ) diff --git a/verse/settings.toml b/verse/settings.toml index 763173b..287c705 100644 --- a/verse/settings.toml +++ b/verse/settings.toml @@ -1,4 +1,4 @@ title = "Varia Archive X Distribusi-Verse" categories = ["event","gathering","work session","workgroup","performance","music event"] start_time = 2017-11-03 -end_time = 2024-12-31 +end_time = 2025-12-31