Skip to content
Snippets Groups Projects
Commit 35181bae authored by Julian's avatar Julian
Browse files

Make weekdays selectable in backend

parent 7e337c81
Branches 130-show-print-timetable-button-on-mobile-devices
No related tags found
1 merge request!385Resolve "Hide days"
Pipeline #193605 failed
......@@ -122,3 +122,25 @@ class SupervisionEventFeedColor(StringPreference):
verbose_name = _("Supervision calendar feed color")
widget = ColorWidget
required = True
@site_preferences_registry.register
class DaysInCalendar(MultipleChoicePreference):
section = chronos
name = "days_in_calendar"
default = ["1", "2", "3", "4", "5"]
verbose_name = _("Days of the week that appear in the timetable")
choices = [
("1", _("Monday")),
("2", _("Tuesday")),
("3", _("Wednesday")),
("4", _("Thursday")),
("5", _("Friday")),
("6", _("Saturday")),
("0", _("Sunday")),
]
required = True
def validate(self, value):
for v in value:
if int(v) not in self.get_choice_values():
raise ValidationError(f"{v} is not a valid choice")
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