Просмотр исходного кода

Fixes #15771: Show id field as supported on all bulk import forms

Jeremy Stretch 1 год назад
Родитель
Сommit
e87877b6ea
2 измененных файлов с 6 добавлено и 5 удалено
  1. 0 5
      netbox/netbox/forms/base.py
  2. 6 0
      netbox/utilities/forms/forms.py

+ 0 - 5
netbox/netbox/forms/base.py

@@ -73,11 +73,6 @@ class NetBoxModelImportForm(CSVModelForm, NetBoxModelForm):
     """
     Base form for creating a NetBox objects from CSV data. Used for bulk importing.
     """
-    id = forms.IntegerField(
-        label=_('Id'),
-        required=False,
-        help_text='Numeric ID of an existing object to update (if not creating a new object)'
-    )
     tags = CSVModelMultipleChoiceField(
         label=_('Tags'),
         queryset=Tag.objects.all(),

+ 6 - 0
netbox/utilities/forms/forms.py

@@ -70,6 +70,12 @@ class CSVModelForm(forms.ModelForm):
     """
     ModelForm used for the import of objects in CSV format.
     """
+    id = forms.IntegerField(
+        label=_('ID'),
+        required=False,
+        help_text=_('Numeric ID of an existing object to update (if not creating a new object)')
+    )
+
     def __init__(self, *args, headers=None, **kwargs):
         self.headers = headers or {}
         super().__init__(*args, **kwargs)