custom form fields(parameters) on NetboxModelImportView #18633
Unanswered
nix6
asked this question in
Help Wanted!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I am trying to add a custom parameter to Netbox bulk import form, similar to existing parameters like
Format
,csv_delimiter
,upload_file
.Scenario:
There is a model
DemoModel
with threeCharFields
:batch_name
,field1
,field2
.I want to be able to import a CSV file with only
field1
andfield2
and add to each row a value from the form input field forbatch_name
.I tried the following:
Then in
views.py
:In
custom_import.html
I added rendering ofform.batch_name
, but I get an error. After reviewing in Django Debug Toolbar, I see that the fieldbatch_name
is sent to the template in the context variable "fields", not "form". And it is showing in the "Field options" list at the bottom of the form.Is there a way to customize the import form with an additional parameter? If not, what would be an alternative approach?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions