netbox/netbox/wireless/forms/bulk_import.py

36 lines
886 B
Python
Raw Normal View History

2021-10-13 09:46:17 -04:00
from dcim.models import Interface
from extras.forms import CustomFieldModelCSVForm
from ipam.models import VLAN
from utilities.forms import CSVModelChoiceField
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 09:46:17 -04:00
'WirelessLinkCSVForm',
)
2021-10-12 17:02:53 -04:00
class WirelessLANCSVForm(CustomFieldModelCSVForm):
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
fields = ('ssid', 'description', 'vlan')
2021-10-13 09:46:17 -04:00
class WirelessLinkCSVForm(CustomFieldModelCSVForm):
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')