9856 merge feature

This commit is contained in:
Arthur
2024-03-04 14:18:58 -08:00
186 changed files with 10634 additions and 5525 deletions

View File

@@ -28,6 +28,7 @@ class WirelessLANGroupSerializer(NestedGroupModelSerializer):
'id', 'url', 'display', 'name', 'slug', 'parent', 'description', 'tags', 'custom_fields', 'created',
'last_updated', 'wirelesslan_count', '_depth',
]
brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'wirelesslan_count', '_depth')
class WirelessLANSerializer(NetBoxModelSerializer):
@@ -45,6 +46,7 @@ class WirelessLANSerializer(NetBoxModelSerializer):
'id', 'url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'tenant', 'auth_type',
'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
]
brief_fields = ('id', 'url', 'display', 'ssid', 'description')
class WirelessLinkSerializer(NetBoxModelSerializer):
@@ -62,3 +64,4 @@ class WirelessLinkSerializer(NetBoxModelSerializer):
'id', 'url', 'display', 'interface_a', 'interface_b', 'ssid', 'status', 'tenant', 'auth_type',
'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
]
brief_fields = ('id', 'url', 'display', 'ssid', 'description')

View File

@@ -5,4 +5,8 @@ class WirelessConfig(AppConfig):
name = 'wireless'
def ready(self):
from netbox.models.features import register_models
from . import signals, search
# Register models
register_models(*self.get_models())

View File

@@ -19,7 +19,7 @@ class AppTest(APITestCase):
class WirelessLANGroupTest(APIViewTestCases.APIViewTestCase):
model = WirelessLANGroup
brief_fields = ['_depth', 'display', 'id', 'name', 'slug', 'url', 'wirelesslan_count']
brief_fields = ['_depth', 'description', 'display', 'id', 'name', 'slug', 'url', 'wirelesslan_count']
create_data = [
{
'name': 'Wireless LAN Group 4',
@@ -48,7 +48,7 @@ class WirelessLANGroupTest(APIViewTestCases.APIViewTestCase):
class WirelessLANTest(APIViewTestCases.APIViewTestCase):
model = WirelessLAN
brief_fields = ['display', 'id', 'ssid', 'url']
brief_fields = ['description', 'display', 'id', 'ssid', 'url']
@classmethod
def setUpTestData(cls):
@@ -110,7 +110,7 @@ class WirelessLANTest(APIViewTestCases.APIViewTestCase):
class WirelessLinkTest(APIViewTestCases.APIViewTestCase):
model = WirelessLink
brief_fields = ['display', 'id', 'ssid', 'url']
brief_fields = ['description', 'display', 'id', 'ssid', 'url']
bulk_update_data = {
'status': 'planned',
}

View File

@@ -1,4 +1,5 @@
from decimal import Decimal
from django.utils.translation import gettext_lazy as _
from .choices import WirelessChannelChoices
@@ -12,7 +13,7 @@ def get_channel_attr(channel, attr):
Return the specified attribute of a given WirelessChannelChoices value.
"""
if channel not in WirelessChannelChoices.values():
raise ValueError(f"Invalid channel value: {channel}")
raise ValueError(_("Invalid channel value: {channel}").format(channel=channel))
channel_values = channel.split('-')
attrs = {
@@ -22,6 +23,6 @@ def get_channel_attr(channel, attr):
'width': Decimal(channel_values[3]),
}
if attr not in attrs:
raise ValueError(f"Invalid channel attribute: {attr}")
raise ValueError(_("Invalid channel attribute: {name}").format(name=attr))
return attrs[attr]