agateblue / agateblue/django-dynamic-preferences

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

Aberta
#168 6 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
359
Forks
86
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.