mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-30 04:16:24 -06:00
7699 bulk_import
This commit is contained in:
parent
286f56bfc6
commit
4c3d1ce95b
@ -1,3 +1,4 @@
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from dcim.choices import InterfaceModeChoices
|
||||
@ -6,8 +7,9 @@ from extras.models import ConfigTemplate
|
||||
from ipam.models import VRF
|
||||
from netbox.forms import NetBoxModelImportForm
|
||||
from tenancy.models import Tenant
|
||||
from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, SlugField
|
||||
from utilities.forms.fields import CSVChoiceField, CSVContentTypeField, CSVModelChoiceField, SlugField
|
||||
from virtualization.choices import *
|
||||
from virtualization.constants import CLUSTER_SCOPE_TYPES
|
||||
from virtualization.models import *
|
||||
|
||||
__all__ = (
|
||||
@ -55,6 +57,11 @@ class ClusterImportForm(NetBoxModelImportForm):
|
||||
choices=ClusterStatusChoices,
|
||||
help_text=_('Operational status')
|
||||
)
|
||||
scope_type = CSVContentTypeField(
|
||||
queryset=ContentType.objects.filter(model__in=CLUSTER_SCOPE_TYPES),
|
||||
required=False,
|
||||
label=_('Scope type (app & model)')
|
||||
)
|
||||
site = CSVModelChoiceField(
|
||||
label=_('Site'),
|
||||
queryset=Site.objects.all(),
|
||||
@ -72,7 +79,10 @@ class ClusterImportForm(NetBoxModelImportForm):
|
||||
|
||||
class Meta:
|
||||
model = Cluster
|
||||
fields = ('name', 'type', 'group', 'status', 'site', 'tenant', 'description', 'comments', 'tags')
|
||||
fields = ('name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags')
|
||||
labels = {
|
||||
'scope_id': 'Scope ID',
|
||||
}
|
||||
|
||||
|
||||
class VirtualMachineImportForm(NetBoxModelImportForm):
|
||||
|
Loading…
Reference in New Issue
Block a user