1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

62 lines
1.6 KiB
Python
Raw Normal View History

2021-10-13 14:31:30 -04:00
from dcim.choices import LinkStatusChoices
2021-10-13 09:46:17 -04:00
from dcim.models import Interface
from extras.forms import CustomFieldModelCSVForm
from ipam.models import VLAN
2021-10-13 16:40:12 -04:00
from utilities.forms import CSVChoiceField, CSVModelChoiceField, SlugField
2021-10-13 09:46:17 -04:00
from wireless.models import *
__all__ = (
2021-10-12 17:02:53 -04:00
'WirelessLANCSVForm',
2021-10-13 16:40:12 -04:00
'WirelessLANGroupCSVForm',
2021-10-13 09:46:17 -04:00
'WirelessLinkCSVForm',
)
2021-10-13 16:40:12 -04:00
class WirelessLANGroupCSVForm(CustomFieldModelCSVForm):
parent = CSVModelChoiceField(
queryset=WirelessLANGroup.objects.all(),
required=False,
to_field_name='name',
help_text='Parent group'
)
slug = SlugField()
class Meta:
model = WirelessLANGroup
fields = ('name', 'slug', 'parent', 'description')
2021-10-12 17:02:53 -04:00
class WirelessLANCSVForm(CustomFieldModelCSVForm):
2021-10-13 16:40:12 -04:00
group = CSVModelChoiceField(
queryset=WirelessLANGroup.objects.all(),
required=False,
to_field_name='name',
help_text='Assigned group'
)
vlan = CSVModelChoiceField(
queryset=VLAN.objects.all(),
to_field_name='name',
help_text='Bridged VLAN'
)
class Meta:
2021-10-12 17:02:53 -04:00
model = WirelessLAN
2021-10-13 16:40:12 -04:00
fields = ('ssid', 'group', 'description', 'vlan')
2021-10-13 09:46:17 -04:00
class WirelessLinkCSVForm(CustomFieldModelCSVForm):
2021-10-13 14:31:30 -04:00
status = CSVChoiceField(
choices=LinkStatusChoices,
help_text='Connection status'
)
2021-10-13 09:46:17 -04:00
interface_a = CSVModelChoiceField(
queryset=Interface.objects.all()
)
interface_b = CSVModelChoiceField(
queryset=Interface.objects.all()
)
class Meta:
model = WirelessLink
fields = ('interface_a', 'interface_b', 'ssid', 'description')