Skip to content
Snippets Groups Projects
Verified Commit 5400880f authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Use choices function from python-calendarweek for i18n of weekday names

parent 5d161253
No related branches found
No related tags found
1 merge request!85Resolve "Translate weekdays"
Pipeline #3698 passed
......@@ -17,7 +17,11 @@ from django.utils.formats import date_format
from django.utils.translation import gettext_lazy as _
from cache_memoize import cache_memoize
from calendarweek.django import CalendarWeek, i18n_day_abbrs_lazy, i18n_day_names_lazy
from calendarweek.django import (
CalendarWeek,
i18n_day_abbr_choices_lazy,
i18n_day_name_choices_lazy,
)
from colorfield.fields import ColorField
from django_global_request.middleware import get_request
......@@ -125,11 +129,11 @@ class ValidityRange(ExtensibleModel):
class TimePeriod(ValidityRangeRelatedExtensibleModel):
WEEKDAY_CHOICES = list(enumerate(i18n_day_names_lazy()))
WEEKDAY_CHOICES_SHORT = list(enumerate(i18n_day_abbrs_lazy()))
WEEKDAY_CHOICES = i18n_day_name_choices_lazy()
WEEKDAY_CHOICES_SHORT = i18n_day_abbr_choices_lazy()
weekday = models.PositiveSmallIntegerField(
verbose_name=_("Week day"), choices=WEEKDAY_CHOICES
verbose_name=_("Week day"), choices=i18n_day_name_choices_lazy()
)
period = models.PositiveSmallIntegerField(verbose_name=_("Number of period"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment