Further refactoring.

This commit is contained in:
2019-02-12 17:49:07 +01:00
parent c73b374659
commit e3bb076af6
8 changed files with 238 additions and 225 deletions

View File

@@ -8,8 +8,8 @@ def season_choices():
"""
sql, args = db.load_season()
seasons = db.query_db(sql, args, cls=models.Season)
choices = [(s.id, f'{s.code}: {s.game}') for s in seasons]
choices.insert(0, (-1, 'No Season'))
choices = [(s.id, f"{s.code}: {s.game}") for s in seasons]
choices.insert(0, (-1, "No Season"))
return choices
@@ -18,6 +18,7 @@ class SeasonChoicesIterable:
This is used to declare choices for WTForms SelectFields at class definition time.
Be aware that this uses an undocumented WTForms feature and is not guaranteed to work.
"""
def __iter__(self):
for choice in season_choices():
yield choice