django-siteprefs icon indicating copy to clipboard operation
django-siteprefs copied to clipboard

Use in templates and DRF

Open jayvdb opened this issue 4 years ago • 1 comments

Do you have a mechanism for using these settings in templates and exposing some of them to a frontend via an API?

e.g. solo has template tags https://github.com/lazybird/django-solo/tree/master/solo/templatetags , as do many others https://gitlab.com/impala1/django-aboutconfig . While https://github.com/jazzband/django-constance uses a context processor, and I think some use middleware instead. https://github.com/jakubroztocil/django-settings-export/blob/master/django_settings_export.py is a generic app, but it doesnt work unless the siteprefs have been defined in settings.py.

django-dynamic-preferences has an rather complete api, and there are some really basic views @ https://github.com/pennlabs/django-runtime-options/blob/master/options/views.py

https://github.com/hampsterx/django-settings-view-as-json looks like a way to have a basic API read-only view of the settings, but it would make more sense to have a admin-configurable flag "include in API?" for each setting, to only expose ones which are sane to expose.

jayvdb avatar May 27 '20 19:05 jayvdb

API is a very special topic. No one size fits all solution seems possible. Maybe we could offer some primitives (yet I don't known what those may be), but only that. Specialization should rather be done outside of siteprefs.

idlesign avatar May 29 '20 14:05 idlesign