-
Notifications
You must be signed in to change notification settings - Fork 583
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
dumpdata doesn't dump image polymorphic types from filer_file #887
Comments
I believe the error is definitely related to django-polymorphic (my project uses 0.8.1) I can now get around the issue by writing my own command/script and manually changing the queryset_class to the generic QuerySet. My guess is polymorphic may introduce it's own queryset class here. the tip off was found from this random gist.
I'm not sure where a fix is required, there does seem to be some history around dumpdata and polymorphic: jazzband/django-polymorphic#175 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This will now be closed due to inactivity, but feel free to reopen it. |
I'm running into this problem, too. Filer's part of the You can even see this happening when running the
(Trying to run this script fails because it's trying to use The snippet above doesn't work for me, because |
I have a total of two images in filer right now, so dumping just the filer app is pretty short: [
{
"model": "filer.image",
"pk": 1,
"fields": {
"_height": 824.0,
"_width": 1600.0,
"_transparent": false,
"default_alt_text": null,
"default_caption": null,
"subject_location": "",
"file_ptr": 1,
"date_taken": "2024-01-11T05:38:34.404Z",
"author": null,
"must_always_publish_author_credit": false,
"must_always_publish_copyright": false
}
},
{
"model": "filer.image",
"pk": 2,
"fields": {
"_height": 420.0,
"_width": 600.0,
"_transparent": true,
"default_alt_text": null,
"default_caption": null,
"subject_location": "",
"file_ptr": 2,
"date_taken": "2024-01-11T05:39:42.557Z",
"author": null,
"must_always_publish_author_credit": false,
"must_always_publish_copyright": false
}
},
{
"model": "filer.clipboard",
"pk": 1,
"fields": {
"user": [
"desimone"
]
}
},
{
"model": "filer.image",
"pk": 1,
"fields": {
"_height": 824.0,
"_width": 1600.0,
"_transparent": false,
"default_alt_text": null,
"default_caption": null,
"subject_location": "",
"file_ptr": 1,
"date_taken": "2024-01-11T05:38:34.404Z",
"author": null,
"must_always_publish_author_credit": false,
"must_always_publish_copyright": false
}
},
{
"model": "filer.image",
"pk": 2,
"fields": {
"_height": 420.0,
"_width": 600.0,
"_transparent": true,
"default_alt_text": null,
"default_caption": null,
"subject_location": "",
"file_ptr": 2,
"date_taken": "2024-01-11T05:39:42.557Z",
"author": null,
"must_always_publish_author_credit": false,
"must_always_publish_copyright": false
}
}
] You can see the images are duplicated and there are no file objects, so the |
Also this is my
It's dated, as I'm resurrecting an old project and trying to update the database (psql 15 -> 17) before I start updating Python packages. This is also done in containers, so I can't get both versions of psql in the db container so I can do an in-place upgrade. |
That output is surprising, especially since dumpdata works for me. Have you tried vasdee's script? I do not see a quick fix other than manually dumping the data. :-( |
It's surprising to me, too.
Yeah. It didn't work, because it assumes some setup not in the snippet.
|
Probably |
The problem was the use of the
In hindsight, the problem seems obvious. |
When trying to migrate my media from filer (within a djangocms 3.2 and 3.3 environment if that helps)
manage.py dumpdata --natural-foreign --indent=4 filer
The resulting json file has no Image records within filer_file, however it does produce the filer_image records - which then causes a foreign key constraint violation if i try to load the data in another environment.
I've also tried dumpdata across the single model table, filer.file - with the same result.
For a more in depth example. If i have 20 files manged by filer in my application, 5 pdfs and 15 images. Running dumpdata across filer will result in 5 filer.file JSON objects and 15 filer.image JSON objects in the resulting JSON fixture. Whereas i would expect 20 filer.file JSON objects as the two tables are linked.
This is the same result running against sqlite with both django 1.8.13 and 1.9.7
The text was updated successfully, but these errors were encountered: