Skip to content
Snippets Groups Projects

Convert enums to lists for Django choices

1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
+ 4
4
@@ -61,25 +61,25 @@ def i18n_month_abbrs(loc: Optional[str] = None) -> Tuple[str]:
@@ -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]]:
def i18n_day_name_choices(loc: Optional[str] = None) -> Tuple[Tuple[int, str]]:
""" Return an enumeration of day names for the current locale. """
""" 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]]:
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 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]]:
def i18n_month_name_choices(loc: Optional[str] = None) -> Tuple[Tuple[int, str]]:
""" Return an enumeration of month names for the current locale. """
""" 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]]:
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 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:
def i18n_js(request: HttpRequest) -> HttpResponse:
Loading