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

Fixes #6908: Allow assignment of scope to VLAN groups upon import

This commit is contained in:
jeremystretch
2021-08-09 09:54:27 -04:00
parent 7bcebd5b0f
commit 1bb596fc7e
4 changed files with 18 additions and 7 deletions

View File

@@ -11,9 +11,9 @@ from tenancy.forms import TenancyFilterForm, TenancyForm
from tenancy.models import Tenant
from utilities.forms import (
add_blank_choice, BootstrapMixin, BulkEditNullBooleanSelect, ContentTypeChoiceField, CSVChoiceField,
CSVModelChoiceField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableIPAddressField,
NumericArrayField, ReturnURLForm, SlugField, StaticSelect2, StaticSelect2Multiple, TagFilterField,
BOOLEAN_WITH_BLANK_CHOICES,
CSVContentTypeField, CSVModelChoiceField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField,
ExpandableIPAddressField, NumericArrayField, ReturnURLForm, SlugField, StaticSelect2, StaticSelect2Multiple,
TagFilterField, BOOLEAN_WITH_BLANK_CHOICES,
)
from virtualization.models import Cluster, ClusterGroup, VirtualMachine, VMInterface
from .choices import *
@@ -1239,10 +1239,18 @@ class VLANGroupForm(BootstrapMixin, CustomFieldModelForm):
class VLANGroupCSVForm(CustomFieldModelCSVForm):
slug = SlugField()
scope_type = CSVContentTypeField(
queryset=ContentType.objects.filter(model__in=VLANGROUP_SCOPE_TYPES),
required=False,
label='Scope type (app & model)'
)
class Meta:
model = VLANGroup
fields = VLANGroup.csv_headers
labels = {
'scope_id': 'Scope ID',
}
class VLANGroupBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):