-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk import custom fields #568
Comments
Example use case: I have added a custom field "FQDN" to the "ipam > IP Address" model. I'm importing a load of IP addresses in CSV format, and I want to import the corresponding FQDNs at the same time. |
I had the same need for the DCIM/Device model. I very naively did: --- a/netbox/dcim/forms.py
+++ b/netbox/dcim/forms.py
@@ -777,7 +777,7 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldForm):
self.initial['rack'] = self.instance.parent_bay.device.rack_id
-class BaseDeviceCSVForm(forms.ModelForm):
+class BaseDeviceCSVForm(BootstrapMixin, CustomFieldForm):
device_role = forms.ModelChoiceField(
queryset=DeviceRole.objects.all(),
to_field_name='name', …andi it seems to have done the trick: a new CSV field, prefixed with Are there complexities I haven't encountered yet or is it just that simple? |
@paravoid I attempted this same thing in the IPAM forms.py (
I don't know for certain if the API actually broke or if it was just Swagger docs...but something was unhappy. Netbox v2.2.8 |
This reverts commit 07a7fac. We've now migrated to Netbox and we don't need anymore this local change and it's easier to upgrade the repository to the latest upstream version without local modifications. The upstream issue for this is: netbox-community/netbox#568 Bug: T205896 Change-Id: Id71e0e2ed1e817d18bb5c67575e294625b266c8b
* Update netbox from branch 'master' to b6a2931e0dc5fa11a2004dad7acc812863aa7555 - Revert "Allow custom fields in the Device CSV form" This reverts commit 07a7facdf44d6c86cd045c0a336541b37cb4d718. We've now migrated to Netbox and we don't need anymore this local change and it's easier to upgrade the repository to the latest upstream version without local modifications. The upstream issue for this is: netbox-community/netbox#568 Bug: T205896 Change-Id: Id71e0e2ed1e817d18bb5c67575e294625b266c8b
I'm going to have a go at implementing this, and do a pull request. I'm thinking it would also make sense to export custom fields via the various CSV templates. Does this sound good? Is it within scope of this ticket, or should I create a new one? |
I've created a draft pull request to address Custom Field importing and exporting: #2949 Would a project maintainer be able to take a look and provide feedback? |
After creating a very large CSV of data, mainly custom field data, we've also discovered this functionality isn't yet there. Thanks for doing the work @anthonyeden, does your PR encompass imports for just Devices? Or does it cover Virtual Machines etc also? |
Hi @iDemonix, This pull request now encompasses all different CSV Import models. Would you mind testing it for me and reporting back here? |
Fixes #568: CSV import/export of custom fields
…port Closes #568: Extend CSV import to support custom fields
I'd like the possibility, one some custom fields are defined, to have them importable in bulk.
The text was updated successfully, but these errors were encountered: