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

Fix tag assignment when bulk creating components

This commit is contained in:
Jeremy Stretch
2020-04-22 14:05:27 -04:00
parent 6a61f0911d
commit 7b50f2b0eb
3 changed files with 40 additions and 40 deletions

View File

@ -828,6 +828,11 @@ class VirtualMachineBulkAddComponentForm(BootstrapMixin, forms.Form):
label='Name'
)
def clean_tags(self):
# Because we're feeding TagField data (on the bulk edit form) to another TagField (on the model form), we
# must first convert the list of tags to a string.
return ','.join(self.cleaned_data.get('tags'))
class InterfaceBulkCreateForm(
form_from_model(Interface, ['enabled', 'mtu', 'description', 'tags']),
@ -838,6 +843,3 @@ class InterfaceBulkCreateForm(
initial=VMInterfaceTypeChoices.TYPE_VIRTUAL,
widget=forms.HiddenInput()
)
tags = TagField(
required=False
)