mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 21:29:24 +02:00
#186: common utils for moving settings to preferences
This commit is contained in:
parent
e226d60c6a
commit
aa3da412a7
1 changed files with 12 additions and 0 deletions
12
api/funkwhale_api/common/preferences.py
Normal file
12
api/funkwhale_api/common/preferences.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from django.conf import settings
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
|
||||
class DefaultFromSettingMixin(object):
|
||||
def get_default(self):
|
||||
return getattr(settings, self.setting)
|
||||
|
||||
|
||||
def get(pref):
|
||||
manager = global_preferences_registry.manager()
|
||||
return manager[pref]
|
Loading…
Add table
Add a link
Reference in a new issue