mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add WirelessLANGroup model
This commit is contained in:
@@ -9,15 +9,38 @@ from wireless.models import *
|
||||
|
||||
__all__ = (
|
||||
'WirelessLANBulkEditForm',
|
||||
'WirelessLANGroupBulkEditForm',
|
||||
'WirelessLinkBulkEditForm',
|
||||
)
|
||||
|
||||
|
||||
class WirelessLANGroupBulkEditForm(BootstrapMixin, CustomFieldModelBulkEditForm):
|
||||
pk = forms.ModelMultipleChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
widget=forms.MultipleHiddenInput
|
||||
)
|
||||
parent = DynamicModelChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ['parent', 'description']
|
||||
|
||||
|
||||
class WirelessLANBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm):
|
||||
pk = forms.ModelMultipleChoiceField(
|
||||
queryset=WirelessLAN.objects.all(),
|
||||
widget=forms.MultipleHiddenInput
|
||||
)
|
||||
group = DynamicModelChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
required=False,
|
||||
@@ -31,7 +54,7 @@ class WirelessLANBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldMode
|
||||
)
|
||||
|
||||
class Meta:
|
||||
nullable_fields = ['vlan', 'ssid', 'description']
|
||||
nullable_fields = ['ssid', 'group', 'vlan', 'description']
|
||||
|
||||
|
||||
class WirelessLinkBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm):
|
||||
|
@@ -2,16 +2,37 @@ from dcim.choices import LinkStatusChoices
|
||||
from dcim.models import Interface
|
||||
from extras.forms import CustomFieldModelCSVForm
|
||||
from ipam.models import VLAN
|
||||
from utilities.forms import CSVChoiceField, CSVModelChoiceField
|
||||
from utilities.forms import CSVChoiceField, CSVModelChoiceField, SlugField
|
||||
from wireless.models import *
|
||||
|
||||
__all__ = (
|
||||
'WirelessLANCSVForm',
|
||||
'WirelessLANGroupCSVForm',
|
||||
'WirelessLinkCSVForm',
|
||||
)
|
||||
|
||||
|
||||
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')
|
||||
|
||||
|
||||
class WirelessLANCSVForm(CustomFieldModelCSVForm):
|
||||
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',
|
||||
@@ -20,7 +41,7 @@ class WirelessLANCSVForm(CustomFieldModelCSVForm):
|
||||
|
||||
class Meta:
|
||||
model = WirelessLAN
|
||||
fields = ('ssid', 'description', 'vlan')
|
||||
fields = ('ssid', 'group', 'description', 'vlan')
|
||||
|
||||
|
||||
class WirelessLinkCSVForm(CustomFieldModelCSVForm):
|
||||
|
@@ -3,19 +3,38 @@ from django.utils.translation import gettext as _
|
||||
|
||||
from dcim.choices import LinkStatusChoices
|
||||
from extras.forms import CustomFieldModelFilterForm
|
||||
from utilities.forms import add_blank_choice, BootstrapMixin, StaticSelect, TagFilterField
|
||||
from utilities.forms import (
|
||||
add_blank_choice, BootstrapMixin, DynamicModelMultipleChoiceField, StaticSelect, TagFilterField,
|
||||
)
|
||||
from wireless.models import *
|
||||
|
||||
__all__ = (
|
||||
'WirelessLANFilterForm',
|
||||
'WirelessLANGroupFilterForm',
|
||||
'WirelessLinkFilterForm',
|
||||
)
|
||||
|
||||
|
||||
class WirelessLANGroupFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
model = WirelessLANGroup
|
||||
q = forms.CharField(
|
||||
required=False,
|
||||
widget=forms.TextInput(attrs={'placeholder': _('All Fields')}),
|
||||
label=_('Search')
|
||||
)
|
||||
parent_id = DynamicModelMultipleChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False,
|
||||
label=_('Parent group'),
|
||||
fetch_trigger='open'
|
||||
)
|
||||
|
||||
|
||||
class WirelessLANFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
model = WirelessLAN
|
||||
field_groups = [
|
||||
['q', 'tag'],
|
||||
('q', 'tag'),
|
||||
('group_id',),
|
||||
]
|
||||
q = forms.CharField(
|
||||
required=False,
|
||||
@@ -26,6 +45,13 @@ class WirelessLANFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
required=False,
|
||||
label='SSID'
|
||||
)
|
||||
group_id = DynamicModelMultipleChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
label=_('Group'),
|
||||
fetch_trigger='open'
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
|
@@ -2,16 +2,37 @@ from dcim.models import Interface
|
||||
from extras.forms import CustomFieldModelForm
|
||||
from extras.models import Tag
|
||||
from ipam.models import VLAN
|
||||
from utilities.forms import BootstrapMixin, DynamicModelChoiceField, DynamicModelMultipleChoiceField, StaticSelect
|
||||
from utilities.forms import (
|
||||
BootstrapMixin, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField, StaticSelect,
|
||||
)
|
||||
from wireless.models import *
|
||||
|
||||
__all__ = (
|
||||
'WirelessLANForm',
|
||||
'WirelessLANGroupForm',
|
||||
'WirelessLinkForm',
|
||||
)
|
||||
|
||||
|
||||
class WirelessLANGroupForm(BootstrapMixin, CustomFieldModelForm):
|
||||
parent = DynamicModelChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
slug = SlugField()
|
||||
|
||||
class Meta:
|
||||
model = WirelessLANGroup
|
||||
fields = [
|
||||
'parent', 'name', 'slug', 'description',
|
||||
]
|
||||
|
||||
|
||||
class WirelessLANForm(BootstrapMixin, CustomFieldModelForm):
|
||||
group = DynamicModelChoiceField(
|
||||
queryset=WirelessLANGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
required=False
|
||||
@@ -24,10 +45,10 @@ class WirelessLANForm(BootstrapMixin, CustomFieldModelForm):
|
||||
class Meta:
|
||||
model = WirelessLAN
|
||||
fields = [
|
||||
'ssid', 'description', 'vlan', 'tags',
|
||||
'ssid', 'group', 'description', 'vlan', 'tags',
|
||||
]
|
||||
fieldsets = (
|
||||
('Wireless LAN', ('ssid', 'description', 'tags')),
|
||||
('Wireless LAN', ('ssid', 'group', 'description', 'tags')),
|
||||
('VLAN', ('vlan',)),
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user