Skip to content
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

CSV Import & Export Custom Fields #2949

Closed
wants to merge 5 commits into from
Closed

CSV Import & Export Custom Fields #2949

wants to merge 5 commits into from

Conversation

anthonyeden
Copy link

Fixes: #568

This pull request is my first attempt at resolving ticket #568.

With these changes, you can now import Custom Fields to Devices. The UI has been updated, and a new version of CSVChoiceField has been created to map the select-field labels to the DB values when performing an import.

It also adds custom fields to the CSV Exporter, using the same column headings as the importer.

If these changes are correct, we need to enable Custom Field importing for all other models by replacing 'forms.ModelForm' with 'CustomFieldForm' in the inheritance of the remainder of the CSVForm models.

@anthonyeden anthonyeden marked this pull request as ready for review March 14, 2019 11:23
@anthonyeden
Copy link
Author

This pull request now encompasses all CSV Import models. I'd appreciate anyone testing it, and reporting back here.

@ghost
Copy link

ghost commented Jul 10, 2019

Hey all, we just tried this on a dev server and it works well (even updates the Import screen for custom vars and adds them as required when so tagged), we'd like this change to go in so we can more easily import/export test data blobs between dev servers before we go to production and we have 36 custom fields at present. Any chance this could get committed to main? Looks like a fairly straightforward merge of a new class...

@Mark32
Copy link

Mark32 commented Jul 10, 2019

Hi. Newbie question .. how do I add this branch to my local netbox installation as a branch? Latest release is installed and working and urgently need this custom field import facility (thanks for providing). Thanks

@Mark32
Copy link

Mark32 commented Jul 11, 2019

I've installed from fresh cloning https://github.com/anthonyeden/netbox.git

However the custom field import is not available. What do I need to do to get what is missing in order for this to work? This is a test system. Thanks, Mark

@ghost
Copy link

ghost commented Jul 11, 2019

I'm new to git as well, I think you need to clone the specific branch.

Check out https://confluence.atlassian.com/bitbucket/checkout-a-branch-into-a-local-repository-313466957.html

You'll need the branch "dev_csvcustomfields"
hth

@Mark32
Copy link

Mark32 commented Jul 11, 2019

Thanks tpomerhn that really helped.

git branch -a

  • (HEAD detached at origin/dev_csvcustomfields)
    develop
    remotes/origin/HEAD -> origin/develop
    remotes/origin/dev_csvcustomfields
    remotes/origin/dev_saml
    remotes/origin/develop
    remotes/origin/develop-2.6
    remotes/origin/master

git checkout remotes/origin/dev_csvcustomfields

git branch

  • (HEAD detached at origin/dev_csvcustomfields)
    develop

@Mark32
Copy link

Mark32 commented Jul 11, 2019

Thanks anthonyeden for providing this fundamental and key functionality. I will be importing tenants with custom fields and will provide feedback. Thanks!

@Mark32
Copy link

Mark32 commented Jul 22, 2019

I'm able to import having defined various custom fields. However it breaks when trying to run an export from anywhere. I get:

<class 'TypeError'>

'dict' object is not callable

Screenshot 2019-07-22 at 11 47 26

@netbox-community netbox-community deleted a comment from sgreen1 Sep 4, 2019
@crytectobi
Copy link

I'm able to import having defined various custom fields. However it breaks when trying to run an export from anywhere. I get:

<class 'TypeError'>

'dict' object is not callable

Screenshot 2019-07-22 at 11 47 26

I can confirm that. Import is working fine, export always resolves in that error.

@jeremystretch
Copy link
Member

jeremystretch commented Oct 9, 2019

@anthonyeden can you address the reports above concerning broken export functionality? Also looks like it needs to be rebased against develop.

@lampwins
Copy link
Contributor

lampwins commented Dec 5, 2019

@anthonyeden Are you able to address these issues? Otherwise, this PR will have to be marked as stale.

@anthonyeden
Copy link
Author

@lampwins Apologies, I must've missed the last message. Yes, I will set aside some time to address this.

@jeremystretch
Copy link
Member

I'm going to close this PR as it has been inactive for months and likely needs to be rebased against the current develop branch. However the issue it addresses (#568) remains open so please feel free to submit at any time once updates have been made in the source branch.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bulk import custom fields
5 participants