-
NetBox versionv3.2.3 Python version3.8 Steps to ReproduceI'm developing a NetBox plugin, with CSV import feature. I realized that using NetBoxModelCSVForm I have two options:
Mine is:
Steps to reproduce:
Expected BehaviorData should be imported with blank values. Observed BehaviorThe post return the following error: Row 1: Expected 1 columns but found 4 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
It seems like you might just need some help writing a form, so I've moved this to a discussion. This error in particular suggests that you're not passing data in the expected format:
It would help to present the code you've written thus far for someone to take a look. |
Beta Was this translation helpful? Give feedback.
-
Hello @jeremystretch I realize my report was too short. Let me explain better. I'm building a plugin, basically I need to store access credentials (name, username, password, enable_secret). This is working fine. In the models "name" is mandatory, others are optionals (blank=True). I would like to implement the bulk import via CSV.
With this configuration if I import "test1,admin1,cisco1,cisco1" I get the error: Row 1: Expected 1 columns but found 4 If i set in the form required=true on the three optional parameters I can import "test1,admin1,cisco1,cisco1" but I cannot import "test2,,,": Row 1 username: This field is required, Row 1 password: This field is required...
I also checked in IPAM -> VRFs and I realized that I can bulk Import VRF name but I cannot include other parameters (same error: Row 1: Expected ... columns but found...) I tested and I think it's a bug, but maybe I'm missing something. |
Beta Was this translation helpful? Give feedback.
-
Hello @candlerb, Given your answer, I reinstalled a new NetBox instance using 3.2.4 release (from tar.gz), no plugins, new python venv.
If I try to import:
I have the following error.
The same is happening with the 3.2.3 version. I understand you can read inside the textarea:
Which version are you using? Installed how? |
Beta Was this translation helpful? Give feedback.
-
It works thank you. I didn't realized that I could customize the header. Referring to plugins, can I customize the default expected format? Overriding the default: |
Beta Was this translation helpful? Give feedback.
It works thank you. I didn't realized that I could customize the header. Referring to plugins, can I customize the default expected format?
I mean:
name,username,password,enable_password
Overriding the default:
name