From cb4643d810db504815bf829c1e2d0f473f82d3a3 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 18 Jul 2016 11:59:55 -0400 Subject: [PATCH] Added support for group assignment during VLAN import --- netbox/ipam/forms.py | 4 +++- netbox/templates/ipam/vlan_import.html | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/netbox/ipam/forms.py b/netbox/ipam/forms.py index 4e6e1ff0c..2c1b24192 100644 --- a/netbox/ipam/forms.py +++ b/netbox/ipam/forms.py @@ -503,13 +503,15 @@ class VLANForm(forms.ModelForm, BootstrapMixin): class VLANFromCSVForm(forms.ModelForm): site = forms.ModelChoiceField(queryset=Site.objects.all(), to_field_name='name', error_messages={'invalid_choice': 'Device not found.'}) + group = forms.ModelChoiceField(queryset=VLANGroup.objects.all(), required=False, to_field_name='name', + error_messages={'invalid_choice': 'VLAN group not found.'}) status_name = forms.ChoiceField(choices=[(s[1], s[0]) for s in VLAN_STATUS_CHOICES]) role = forms.ModelChoiceField(queryset=Role.objects.all(), required=False, to_field_name='name', error_messages={'invalid_choice': 'Invalid role.'}) class Meta: model = VLAN - fields = ['site', 'vid', 'name', 'status_name', 'role'] + fields = ['site', 'group', 'vid', 'name', 'status_name', 'role'] def save(self, *args, **kwargs): m = super(VLANFromCSVForm, self).save(commit=False) diff --git a/netbox/templates/ipam/vlan_import.html b/netbox/templates/ipam/vlan_import.html index 538eed44a..ba1265c3f 100644 --- a/netbox/templates/ipam/vlan_import.html +++ b/netbox/templates/ipam/vlan_import.html @@ -33,6 +33,11 @@ Name of assigned site LAS2 + + Group + Name of VLAN group (optional) + Backend Network + ID Configured VLAN ID @@ -56,7 +61,7 @@

Example

-
LAS2,1400,Cameras,Active,Security
+
LAS2,Backend Network,1400,Cameras,Active,Security
{% endblock %}