|
|
@@ -8,8 +8,11 @@ class DCIMConfig(AppConfig):
|
|
|
verbose_name = "DCIM"
|
|
|
|
|
|
def ready(self):
|
|
|
+ from django.utils.translation import gettext as _
|
|
|
+
|
|
|
from netbox.models.features import register_models
|
|
|
from utilities.counters import connect_counters
|
|
|
+ from utilities.permissions import ModelAction, register_model_actions
|
|
|
|
|
|
from . import search, signals # noqa: F401
|
|
|
from .models import CableTermination, Device, DeviceType, ModuleType, RackType, VirtualChassis
|
|
|
@@ -17,6 +20,11 @@ class DCIMConfig(AppConfig):
|
|
|
# Register models
|
|
|
register_models(*self.get_models())
|
|
|
|
|
|
+ # Register custom permission actions
|
|
|
+ register_model_actions(Device, [
|
|
|
+ ModelAction('render_config', help_text=_('Render device configuration')),
|
|
|
+ ])
|
|
|
+
|
|
|
# Register denormalized fields
|
|
|
denormalized.register(CableTermination, '_device', {
|
|
|
'_rack': 'rack',
|