mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-13 20:49:52 +02:00
Fixes #21578: Enable assignment of scope object by name when bulk importing prefixes/VLAN groups (#21671)
This commit is contained in:
@@ -74,8 +74,8 @@ class ClusterImportForm(ScopedImportForm, PrimaryModelImportForm):
|
||||
class Meta:
|
||||
model = Cluster
|
||||
fields = (
|
||||
'name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'owner', 'comments',
|
||||
'tags',
|
||||
'name', 'type', 'group', 'status', 'scope_type', 'scope_name', 'scope_id', 'tenant', 'description', 'owner',
|
||||
'comments', 'tags',
|
||||
)
|
||||
labels = {
|
||||
'scope_id': _('Scope ID'),
|
||||
|
||||
@@ -157,12 +157,20 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
'tags': [t.pk for t in tags],
|
||||
}
|
||||
|
||||
cls.csv_data = (
|
||||
"name,type,status",
|
||||
"Cluster 4,Cluster Type 1,active",
|
||||
"Cluster 5,Cluster Type 1,active",
|
||||
"Cluster 6,Cluster Type 1,active",
|
||||
)
|
||||
cls.csv_data = {
|
||||
'default': (
|
||||
"name,type,status,scope_type,scope_id",
|
||||
f"Cluster 4,Cluster Type 1,active,dcim.site,{sites[0].pk}",
|
||||
f"Cluster 5,Cluster Type 1,active,dcim.site,{sites[0].pk}",
|
||||
f"Cluster 6,Cluster Type 1,active,dcim.site,{sites[0].pk}",
|
||||
),
|
||||
'scope_name': (
|
||||
"name,type,status,scope_type,scope_name",
|
||||
f"Cluster 4,Cluster Type 1,active,dcim.site,{sites[0].name}",
|
||||
f"Cluster 5,Cluster Type 1,active,dcim.site,{sites[0].name}",
|
||||
f"Cluster 6,Cluster Type 1,active,dcim.site,{sites[0].name}",
|
||||
),
|
||||
}
|
||||
|
||||
cls.csv_update_data = (
|
||||
"id,name,comments",
|
||||
|
||||
Reference in New Issue
Block a user