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

Import/Export for single field #1181

Closed
sover02 opened this issue Sep 3, 2020 · 3 comments
Closed

Import/Export for single field #1181

sover02 opened this issue Sep 3, 2020 · 3 comments
Labels

Comments

@sover02
Copy link

sover02 commented Sep 3, 2020

Hi There - is it possible to import/export a single field value?

I have a JSONField that stores config items that I'd like to enable users to download and update, but don't necessarily want them to have to track the rest of the fields in the file they download/upload.

I'd like to also be able to update the single JSONField via the admin interface at an item level.

I gave the documentation a run-through but didn't quite find the answer I was looking for.

@miguelfg
Copy link

Have you tried to:
1 export it first,
2 drop all fields except id and your JSONField,
3 modify your JSONField
4 import this json file

Hmm, you might want to do steps 1,2 and 3 as csv, and then convert the csv to json. With pandas the right way for me to generate the json file that is correclty imported is as:

df.to_json("YOUR FILE PATH.json", orient='records')

@ekarmazin
Copy link

Same question here, how to export a single item only? The 'exclude' option is great, but I have hundreds items and I just need only particular one by id.

export 100+ rows and drop fields is not an option at all.

@matthewhegarty
Copy link
Contributor

We added a filter_queryset() function in #1579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants