Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how plugin settings are used #10346

Closed
hagbarddenstore opened this issue Sep 12, 2022 · 2 comments
Closed

Document how plugin settings are used #10346

hagbarddenstore opened this issue Sep 12, 2022 · 2 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: documentation A change or addition to the documentation

Comments

@hagbarddenstore
Copy link
Contributor

Change Type

Addition

Area

Functionality/features

Proposed Changes

In the plugin development section, it is not documented how a plugin should access its own settings.

from django.conf import settings

settings.PLUGINS_CONFIG['plugin_name']['settings_key']

This method works and is Django standard, but NetBox populates the dict with the defaults from the plugin configuration.

I think this should be documented.

@hagbarddenstore hagbarddenstore added the type: documentation A change or addition to the documentation label Sep 12, 2022
@jeremystretch jeremystretch added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Sep 12, 2022
@jeremystretch
Copy link
Member

jeremystretch commented Sep 13, 2022

Maybe it makes sense to provide a helper utility and document its use instead? That might be a bit cleaner for developers, and provide a hook layer for potential future use. Something like:

from extras.plugins import get_plugin_config

myvar = get_plugin_config('plugin_name', 'myvar')

@DanSheps
Copy link
Member

I think an associated templatetag might also be wise.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Oct 3, 2022
@jeremystretch jeremystretch self-assigned this Oct 3, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: documentation A change or addition to the documentation
Projects
None yet
Development

No branches or pull requests

3 participants