From e87877b6ea15231df1e7e10a74c69a4e1c6407aa Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 22 Apr 2024 09:38:40 -0400 Subject: [PATCH] Fixes #15771: Show id field as supported on all bulk import forms --- netbox/netbox/forms/base.py | 5 ----- netbox/utilities/forms/forms.py | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/netbox/netbox/forms/base.py b/netbox/netbox/forms/base.py index 0b0e2036e..736a2fe9b 100644 --- a/netbox/netbox/forms/base.py +++ b/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(), diff --git a/netbox/utilities/forms/forms.py b/netbox/utilities/forms/forms.py index 54c9e41cb..93227b1d0 100644 --- a/netbox/utilities/forms/forms.py +++ b/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)