Adding a plug-in to the home page

You can add your plug-in as a card on the Site Planner home page. The card can show how many instances of the plug-in model are present. For example, if you have a 5G network-slicing model, the card can show how many slices are in Site Planner.

You can add plug-ins to cards in the following ways:

Adding a card for a plug-in

To add a card to the home page, you must add the stats.py file to your plug-in. Use the PluginDashboardStatSection and PluginDashboardStatItem classes to create the card. The following example adds an Applications card that contains an Applications item to the home page:

from extras.plugins import PluginDashboardStatSection, PluginDashboardStatItem
from .models import Application

stat_extensions = [
    PluginDashboardStatSection(
        label='Applications',
        icon_class_suffix='window-maximize',
        items=[
            PluginDashboardStatItem(
                label='Applications',
                perm='netbox_applications.view_application',
                count_queryset=Application.objects
            )
        ]
    )
]

Adding an item for a plug-in to a card

You can add an item that represents your plug-in model to a card on the home page. To add the item, you must add the stats.py file to your plug-in. Use the PluginDashboardStatItem class to add the item. The following example adds an Applications item to the Virtualization card:

from extras.plugins import PlacedPluginDashboardStatItem
from .models import Application

stat_extensions = [
    PlacedPluginDashboardStatItem(
        parent_label='Virtualization',
        label='Applications',
        perm='netbox_applications.view_application',
        count_queryset=Application.objects
    )
]