agateblue / agateblue/django-dynamic-preferences

The documentation regarding the use of global_preferences_registry.manager() is not clear

未關閉
#168 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
359
分支
86
PR 合併指標
30 天內沒有已合併 PR

描述

the documentation suggests that a pattern as below works

```python
prefs = global_preferences_registry.manager()
my_preference = prefs.get('my_section__my_ name')
```

it does but **it will not pick the current value of the preference**. one needs to use something along the lines of

```python
def get_preference(key=None):
"""
get the preference
"""
preferences = global_preferences_registry.manager().load_from_db()
try:
return preferences.get(key)
except Exception as error:
raise error
```

I suggest that the documentation is updated to reflect this

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。