From a56829588c1f0f97826b98016882ff2aaef34f28 Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Mon, 20 Jan 2020 21:20:40 +0100 Subject: [PATCH] Convert enums to lists for Django choices Makes using in Django templates easier --- calendarweek/django.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/calendarweek/django.py b/calendarweek/django.py index 8a58260..4a5bfe2 100644 --- a/calendarweek/django.py +++ b/calendarweek/django.py @@ -61,25 +61,25 @@ def i18n_month_abbrs(loc: Optional[str] = None) -> Tuple[str]: def i18n_day_name_choices(loc: Optional[str] = None) -> Tuple[Tuple[int, str]]: """ Return an enumeration of day names for the current locale. """ - return enumerate(i18n_day_names(loc)) + return list(enumerate(i18n_day_names(loc))) def i18n_day_abbr_choices(loc: Optional[str] = None) -> Tuple[Tuple[int, str]]: """ Return an enumeration of day name abbreviations for the current locale. """ - return enumerate(i18n_day_abbrs(loc)) + return list(enumerate(i18n_day_abbrs(loc))) def i18n_month_name_choices(loc: Optional[str] = None) -> Tuple[Tuple[int, str]]: """ Return an enumeration of month names for the current locale. """ - return enumerate(i18n_month_names(loc)) + return list(enumerate(i18n_month_names(loc))) def i18n_month_abbr_choices(loc: Optional[str] = None) -> Tuple[Tuple[int, str]]: """ Return an enumeration of month name abbreviations for the current locale. """ - return enumerate(i18n_month_abbrs(loc)) + return list(enumerate(i18n_month_abbrs(loc))) def i18n_js(request: HttpRequest) -> HttpResponse: -- GitLab