Closed hansegucker closed 2 years ago
I think the behaviour is correct. Well, "correct" is probably subjective, but it matches Django's behaviour for model fields (a model field with null=True
and a default
correctly behaves the same way).
This is indeed the expected behaviour, and has several benefits. Accessing the preference from your code will set the value to the default, when needed. And if you need to apply the default value explicitely on a preference save, you can do it manually :)
Also see https://github.com/agateblue/django-dynamic-preferences/issues/189 for more context/help
When there is a preference called "test" with the default "123" and required=False, the initial value of the preference is of course "123". Then a user might change the preference and its value got "456". In the next step, the user clears the field and saves the preference. Now it's "", but I would expect it to get the default again ("123").