idlesign / django-siteprefs

Reusable app for Django introducing site preferences system
https://github.com/idlesign/django-siteprefs
BSD 3-Clause "New" or "Revised" License
17 stars 6 forks source link

Use in templates and DRF #19

Open jayvdb opened 4 years ago

jayvdb commented 4 years ago

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.

idlesign commented 4 years ago

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.