mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-13 16:47:34 -06:00
This commit is contained in:
parent
e3509c092a
commit
9e0493c64c
@ -238,10 +238,18 @@ class TagImportForm(CSVModelForm):
|
|||||||
label=_('Weight'),
|
label=_('Weight'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
object_types = CSVMultipleContentTypeField(
|
||||||
|
label=_('Object types'),
|
||||||
|
queryset=ObjectType.objects.with_feature('tags'),
|
||||||
|
help_text=_("One or more assigned object types"),
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Tag
|
model = Tag
|
||||||
fields = ('name', 'slug', 'color', 'weight', 'description')
|
fields = (
|
||||||
|
'name', 'slug', 'color', 'weight', 'description', 'object_types',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class JournalEntryImportForm(NetBoxModelImportForm):
|
class JournalEntryImportForm(NetBoxModelImportForm):
|
||||||
|
@ -444,6 +444,8 @@ class TagTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
|
|
||||||
|
site_ct = ContentType.objects.get_for_model(Site)
|
||||||
|
|
||||||
tags = (
|
tags = (
|
||||||
Tag(name='Tag 1', slug='tag-1'),
|
Tag(name='Tag 1', slug='tag-1'),
|
||||||
Tag(name='Tag 2', slug='tag-2', weight=1),
|
Tag(name='Tag 2', slug='tag-2', weight=1),
|
||||||
@ -456,14 +458,15 @@ class TagTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
|
|||||||
'slug': 'tag-x',
|
'slug': 'tag-x',
|
||||||
'color': 'c0c0c0',
|
'color': 'c0c0c0',
|
||||||
'comments': 'Some comments',
|
'comments': 'Some comments',
|
||||||
|
'object_types': [site_ct.pk],
|
||||||
'weight': 11,
|
'weight': 11,
|
||||||
}
|
}
|
||||||
|
|
||||||
cls.csv_data = (
|
cls.csv_data = (
|
||||||
"name,slug,color,description,weight",
|
"name,slug,color,description,object_types,weight",
|
||||||
"Tag 4,tag-4,ff0000,Fourth tag,0",
|
"Tag 4,tag-4,ff0000,Fourth tag,dcim.interface,0",
|
||||||
"Tag 5,tag-5,00ff00,Fifth tag,1111",
|
"Tag 5,tag-5,00ff00,Fifth tag,'dcim.device,dcim.site',1111",
|
||||||
"Tag 6,tag-6,0000ff,Sixth tag,0",
|
"Tag 6,tag-6,0000ff,Sixth tag,dcim.site,0",
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.csv_update_data = (
|
cls.csv_update_data = (
|
||||||
|
Loading…
Reference in New Issue
Block a user