Skip to content

Commit

Permalink
#14036: Update import paths in example plugin code
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Dec 29, 2023
1 parent 33af942 commit c1ff748
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/plugins/development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The plugin source directory contains all the actual Python code and other resour
The `PluginConfig` class is a NetBox-specific wrapper around Django's built-in [`AppConfig`](https://docs.djangoproject.com/en/stable/ref/applications/) class. It is used to declare NetBox plugin functionality within a Python package. Each plugin should provide its own subclass, defining its name, metadata, and default and required configuration parameters. An example is below:

```python
from extras.plugins import PluginConfig
from netbox.plugins import PluginConfig

class FooBarConfig(PluginConfig):
name = 'foo_bar'
Expand Down Expand Up @@ -121,7 +121,7 @@ All required settings must be configured by the user. If a configuration paramet
Plugin configuration parameters can be accessed using the `get_plugin_config()` function. For example:

```python
from extras.plugins import get_plugin_config
from netbox.plugins import get_plugin_config
get_plugin_config('my_plugin', 'verbose_name')
```

Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/development/navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
A plugin can register its own submenu as part of NetBox's navigation menu. This is done by defining a variable named `menu` in `navigation.py`, pointing to an instance of the `PluginMenu` class. Each menu must define a label and grouped menu items (discussed below), and may optionally specify an icon. An example is shown below.

```python title="navigation.py"
from extras.plugins import PluginMenu
from netbox.plugins import PluginMenu

menu = PluginMenu(
label='My Plugin',
Expand Down Expand Up @@ -49,7 +49,7 @@ menu_items = (item1, item2, item3)
Each menu item represents a link and (optionally) a set of buttons comprising one entry in NetBox's navigation menu. Menu items are defined as PluginMenuItem instances. An example is shown below.

```python title="navigation.py"
from extras.plugins import PluginMenuButton, PluginMenuItem
from netbox.plugins import PluginMenuButton, PluginMenuItem
from utilities.choices import ButtonColorChoices

item1 = PluginMenuItem(
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/development/views.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ For example, accessing `{{ request.user }}` within a template will return the cu
Declared subclasses should be gathered into a list or tuple for integration with NetBox. By default, NetBox looks for an iterable named `template_extensions` within a `template_content.py` file. (This can be overridden by setting `template_extensions` to a custom value on the plugin's PluginConfig.) An example is below.

```python
from extras.plugins import PluginTemplateExtension
from netbox.plugins import PluginTemplateExtension
from .models import Animal

class SiteAnimalCount(PluginTemplateExtension):
Expand Down

0 comments on commit c1ff748

Please sign in to comment.