2023-04-15 20:59:44 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from datetime import time
|
|
|
|
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
|
|
|
import dbsettings
|
|
|
|
|
2023-06-05 00:39:08 +00:00
|
|
|
from core.fields import NapStartMaxTimeField, NapStartMinTimeField
|
2023-04-15 20:59:44 +00:00
|
|
|
from .widgets import TimeInput
|
|
|
|
|
|
|
|
|
2023-06-05 00:39:08 +00:00
|
|
|
class NapStartMaxTimeValue(dbsettings.TimeValue):
|
|
|
|
field = NapStartMaxTimeField
|
|
|
|
|
|
|
|
|
|
|
|
class NapStartMinTimeValue(dbsettings.TimeValue):
|
|
|
|
field = NapStartMinTimeField
|
|
|
|
|
|
|
|
|
2023-04-15 20:59:44 +00:00
|
|
|
class NapSettings(dbsettings.Group):
|
2023-06-05 00:39:08 +00:00
|
|
|
nap_start_min = NapStartMinTimeValue(
|
2023-04-15 20:59:44 +00:00
|
|
|
default=time(6),
|
|
|
|
description=_("Default minimum nap start time"),
|
|
|
|
help_text=_(
|
|
|
|
"The minimum default time that a sleep entry is consider a nap. If set the "
|
|
|
|
"nap property will be preselected if the start time is within the bounds."
|
|
|
|
),
|
|
|
|
widget=TimeInput,
|
|
|
|
)
|
2023-06-05 00:39:08 +00:00
|
|
|
nap_start_max = NapStartMaxTimeValue(
|
2023-04-15 20:59:44 +00:00
|
|
|
default=time(18),
|
|
|
|
description=_("Default maximum nap start time"),
|
|
|
|
help_text=_(
|
|
|
|
"The maximum default time that a sleep entry is consider a nap. If set the "
|
|
|
|
"nap property will be preselected if the start time is within the bounds."
|
|
|
|
),
|
|
|
|
widget=TimeInput,
|
|
|
|
)
|