mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#4347: Rename NetBoxModelCSVForm to NetBoxModelImportForm
This commit is contained in:
@@ -10,16 +10,16 @@ from extras.utils import FeatureQuery
|
||||
from utilities.forms import CSVChoiceField, CSVContentTypeField, CSVModelForm, CSVMultipleContentTypeField, SlugField
|
||||
|
||||
__all__ = (
|
||||
'CustomFieldCSVForm',
|
||||
'CustomLinkCSVForm',
|
||||
'ExportTemplateCSVForm',
|
||||
'SavedFilterCSVForm',
|
||||
'TagCSVForm',
|
||||
'WebhookCSVForm',
|
||||
'CustomFieldImportForm',
|
||||
'CustomLinkImportForm',
|
||||
'ExportTemplateImportForm',
|
||||
'SavedFilterImportForm',
|
||||
'TagImportForm',
|
||||
'WebhookImportForm',
|
||||
)
|
||||
|
||||
|
||||
class CustomFieldCSVForm(CSVModelForm):
|
||||
class CustomFieldImportForm(CSVModelForm):
|
||||
content_types = CSVMultipleContentTypeField(
|
||||
queryset=ContentType.objects.all(),
|
||||
limit_choices_to=FeatureQuery('custom_fields'),
|
||||
@@ -54,7 +54,7 @@ class CustomFieldCSVForm(CSVModelForm):
|
||||
)
|
||||
|
||||
|
||||
class CustomLinkCSVForm(CSVModelForm):
|
||||
class CustomLinkImportForm(CSVModelForm):
|
||||
content_types = CSVMultipleContentTypeField(
|
||||
queryset=ContentType.objects.all(),
|
||||
limit_choices_to=FeatureQuery('custom_links'),
|
||||
@@ -69,7 +69,7 @@ class CustomLinkCSVForm(CSVModelForm):
|
||||
)
|
||||
|
||||
|
||||
class ExportTemplateCSVForm(CSVModelForm):
|
||||
class ExportTemplateImportForm(CSVModelForm):
|
||||
content_types = CSVMultipleContentTypeField(
|
||||
queryset=ContentType.objects.all(),
|
||||
limit_choices_to=FeatureQuery('export_templates'),
|
||||
@@ -83,7 +83,7 @@ class ExportTemplateCSVForm(CSVModelForm):
|
||||
)
|
||||
|
||||
|
||||
class SavedFilterCSVForm(CSVModelForm):
|
||||
class SavedFilterImportForm(CSVModelForm):
|
||||
content_types = CSVMultipleContentTypeField(
|
||||
queryset=ContentType.objects.all(),
|
||||
help_text=_("One or more assigned object types")
|
||||
@@ -96,7 +96,7 @@ class SavedFilterCSVForm(CSVModelForm):
|
||||
)
|
||||
|
||||
|
||||
class WebhookCSVForm(CSVModelForm):
|
||||
class WebhookImportForm(CSVModelForm):
|
||||
content_types = CSVMultipleContentTypeField(
|
||||
queryset=ContentType.objects.all(),
|
||||
limit_choices_to=FeatureQuery('webhooks'),
|
||||
@@ -112,7 +112,7 @@ class WebhookCSVForm(CSVModelForm):
|
||||
)
|
||||
|
||||
|
||||
class TagCSVForm(CSVModelForm):
|
||||
class TagImportForm(CSVModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.urls import reverse
|
||||
from rest_framework import status
|
||||
|
||||
from dcim.filtersets import SiteFilterSet
|
||||
from dcim.forms import SiteCSVForm
|
||||
from dcim.forms import SiteImportForm
|
||||
from dcim.models import Manufacturer, Rack, Site
|
||||
from extras.choices import *
|
||||
from extras.models import CustomField
|
||||
@@ -983,7 +983,7 @@ class CustomFieldImportTest(TestCase):
|
||||
'slug': 'site-1',
|
||||
}
|
||||
|
||||
form = SiteCSVForm(data=form_data)
|
||||
form = SiteImportForm(data=form_data)
|
||||
self.assertFalse(form.is_valid())
|
||||
self.assertIn('cf_text', form.errors)
|
||||
|
||||
@@ -997,7 +997,7 @@ class CustomFieldImportTest(TestCase):
|
||||
'cf_select': 'Choice X'
|
||||
}
|
||||
|
||||
form = SiteCSVForm(data=form_data)
|
||||
form = SiteImportForm(data=form_data)
|
||||
self.assertFalse(form.is_valid())
|
||||
self.assertIn('cf_select', form.errors)
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class CustomFieldDeleteView(generic.ObjectDeleteView):
|
||||
|
||||
class CustomFieldBulkImportView(generic.BulkImportView):
|
||||
queryset = CustomField.objects.all()
|
||||
model_form = forms.CustomFieldCSVForm
|
||||
model_form = forms.CustomFieldImportForm
|
||||
table = tables.CustomFieldTable
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class CustomLinkDeleteView(generic.ObjectDeleteView):
|
||||
|
||||
class CustomLinkBulkImportView(generic.BulkImportView):
|
||||
queryset = CustomLink.objects.all()
|
||||
model_form = forms.CustomLinkCSVForm
|
||||
model_form = forms.CustomLinkImportForm
|
||||
table = tables.CustomLinkTable
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ class ExportTemplateDeleteView(generic.ObjectDeleteView):
|
||||
|
||||
class ExportTemplateBulkImportView(generic.BulkImportView):
|
||||
queryset = ExportTemplate.objects.all()
|
||||
model_form = forms.ExportTemplateCSVForm
|
||||
model_form = forms.ExportTemplateImportForm
|
||||
table = tables.ExportTemplateTable
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ class SavedFilterDeleteView(SavedFilterMixin, generic.ObjectDeleteView):
|
||||
|
||||
class SavedFilterBulkImportView(SavedFilterMixin, generic.BulkImportView):
|
||||
queryset = SavedFilter.objects.all()
|
||||
model_form = forms.SavedFilterCSVForm
|
||||
model_form = forms.SavedFilterImportForm
|
||||
table = tables.SavedFilterTable
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ class WebhookDeleteView(generic.ObjectDeleteView):
|
||||
|
||||
class WebhookBulkImportView(generic.BulkImportView):
|
||||
queryset = Webhook.objects.all()
|
||||
model_form = forms.WebhookCSVForm
|
||||
model_form = forms.WebhookImportForm
|
||||
table = tables.WebhookTable
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@ class TagDeleteView(generic.ObjectDeleteView):
|
||||
|
||||
class TagBulkImportView(generic.BulkImportView):
|
||||
queryset = Tag.objects.all()
|
||||
model_form = forms.TagCSVForm
|
||||
model_form = forms.TagImportForm
|
||||
table = tables.TagTable
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user