66 lines
1.6 KiB
Python
66 lines
1.6 KiB
Python
from dynamic_preferences.registries import global_preferences_registry
|
|
from dynamic_preferences import types
|
|
import phonenumbers
|
|
import datetime
|
|
|
|
helper = types.Section("helper")
|
|
|
|
|
|
@global_preferences_registry.register
|
|
class AllowedPhoneCountries(types.MultipleChoicePreference):
|
|
section = helper
|
|
name = "allowed_countries"
|
|
choices = [
|
|
(f"{phonenumbers.country_code_for_region(cc)}", cc)
|
|
for cc in sorted(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 EventState(types.ChoicePreference):
|
|
section = helper
|
|
name = "event_state"
|
|
choices = [
|
|
("BEFORE", "before event"),
|
|
("RUNNING", "event is running"),
|
|
("AFTER", "event is over"),
|
|
]
|
|
default = "BEFORE"
|
|
|
|
|
|
@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)
|
|
|
|
|
|
@global_preferences_registry.register
|
|
class SMSRate(types.IntegerPreference):
|
|
section = helper
|
|
name = "sms_rate"
|
|
default = 2
|
|
help_text = "Number of SMS sent per minute"
|
|
|
|
|
|
@global_preferences_registry.register
|
|
class EnableRegistration(types.BooleanPreference):
|
|
section = helper
|
|
name = "enable_registration"
|
|
default = True
|