add more dynamic settings
parent
11854ab1ce
commit
3a27d32ce5
@ -1,17 +1,38 @@
|
|||||||
from dynamic_preferences.registries import global_preferences_registry
|
from dynamic_preferences.registries import global_preferences_registry
|
||||||
from dynamic_preferences.types import MultipleChoicePreference
|
from dynamic_preferences import types
|
||||||
from dynamic_preferences.types import Section
|
|
||||||
import phonenumbers
|
import phonenumbers
|
||||||
|
import datetime
|
||||||
|
|
||||||
registration = Section("registation")
|
helper = types.Section("helper")
|
||||||
|
|
||||||
|
|
||||||
@global_preferences_registry.register
|
@global_preferences_registry.register
|
||||||
class AllowedPhoneCountries(MultipleChoicePreference):
|
class AllowedPhoneCountries(types.MultipleChoicePreference):
|
||||||
section = registration
|
section = helper
|
||||||
name = "allowed_countries"
|
name = "allowed_countries"
|
||||||
choices = [
|
choices = [
|
||||||
(f"{phonenumbers.country_code_for_region(cc)}", cc)
|
(f"{phonenumbers.country_code_for_region(cc)}", cc)
|
||||||
for cc in phonenumbers.SUPPORTED_REGIONS
|
for cc in phonenumbers.SUPPORTED_REGIONS
|
||||||
]
|
]
|
||||||
default = [49, 41, 43]
|
default = [49, 41, 43]
|
||||||
|
|
||||||
|
|
||||||
|
@global_preferences_registry.register
|
||||||
|
class SendSMS(types.BooleanPreference):
|
||||||
|
section = helper
|
||||||
|
name = "send_sms"
|
||||||
|
default = True
|
||||||
|
|
||||||
|
|
||||||
|
@global_preferences_registry.register
|
||||||
|
class ShiftReminder(types.DurationPreference):
|
||||||
|
section = helper
|
||||||
|
name = "reminder_time"
|
||||||
|
default = datetime.timedelta(minutes=30)
|
||||||
|
|
||||||
|
|
||||||
|
@global_preferences_registry.register
|
||||||
|
class CancelMin(types.DurationPreference):
|
||||||
|
section = helper
|
||||||
|
name = "min_cancel_time"
|
||||||
|
default = datetime.timedelta(hours=6)
|
||||||
|
Loading…
Reference in New Issue