1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Enable CSV import for custom fields

This commit is contained in:
Jeremy Stretch
2020-01-29 14:29:47 -05:00
parent e6b018909d
commit 193435b554
3 changed files with 10 additions and 21 deletions

View File

@@ -94,7 +94,7 @@ class CustomFieldModelCSVForm(CustomFieldModelForm):
# Append form fields
for cf in CustomField.objects.filter(obj_type=self.obj_type):
field_name = 'cf_{}'.format(cf.name)
self.fields[field_name] = cf.to_form_field()
self.fields[field_name] = cf.to_form_field(for_csv_import=True)
# Annotate the field in the list of CustomField form fields
self.custom_fields.append(field_name)