add more dynamic settings
parent
11854ab1ce
commit
3a27d32ce5
@ -1,17 +1,38 @@
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from dynamic_preferences.types import MultipleChoicePreference
|
||||
from dynamic_preferences.types import Section
|
||||
from dynamic_preferences import types
|
||||
import phonenumbers
|
||||
import datetime
|
||||
|
||||
registration = Section("registation")
|
||||
helper = types.Section("helper")
|
||||
|
||||
|
||||
@global_preferences_registry.register
|
||||
class AllowedPhoneCountries(MultipleChoicePreference):
|
||||
section = registration
|
||||
class AllowedPhoneCountries(types.MultipleChoicePreference):
|
||||
section = helper
|
||||
name = "allowed_countries"
|
||||
choices = [
|
||||
(f"{phonenumbers.country_code_for_region(cc)}", cc)
|
||||
for cc in phonenumbers.SUPPORTED_REGIONS
|
||||
]
|
||||
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