django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.77k stars 579 forks source link

Need to reopen issue 887 #1504

Closed greyhare closed 1 week ago

greyhare commented 1 week ago

I don't have permission to reopen issue 887. TL;DR: dumpdata emits the filer_image table in place of the filer_file table, resulting in a fixture with no files, duplicated images, and integrity errors when fed to loaddata.

Also I can't figure out which of the 4000+ contributors are the maintainers so I could @ them instead of making a new issue. Sorry.

fsbraun commented 1 week ago

For me (Django 4.2 and 5.0) dumping and loading fixtures works: first the filer.file table is exported and then filer.image:

[
    {"model": "filer.file", "pk": 1, "fields": {"polymorphic_ctype": 56, "folder": null, "file": "filer_public/.../bla.jpg", "_file_size": 84006, "sha1": "42000b08e6b9c1fb3f8533ba9b7884f7912ebbb3", "has_all_mandatory_data": false, "original_filename": "bla.jpg", "name": "", "description": "", "owner": 1, "uploaded_at": "2024-09-23T17:08:17.704Z", "modified_at": "2024-09-23T17:08:40.285Z", "is_public": true, "mime_type": "image/jpeg"}}, 
    {"model": "filer.clipboard", "pk": 1, "fields": {"user": 1}}, 
    {"model": "filer.image", "pk": 1, "fields": {"_height": 318.0, "_width": 502.0, "_transparent": false, "default_alt_text": null, "default_caption": null, "subject_location": "98,170", "date_taken": "2024-09-23T17:08:17.698Z", "author": null, "must_always_publish_author_credit": false, "must_always_publish_copyright": false}}
]

Be aware that dumpdata does not dump the files themselves, only filer's tables.

The next-gen django-filer will not use django-polymorphic any more (which was the root cause of the issue). Not sure what's going wrong on your side.

@greyhare Can you share a minimal dump for your case?

greyhare commented 1 week ago

Yes, I'm aware that dumpdata doesn't dump the files (though there's a setting to serialize the files into base64 and stuff them in, but I didn't notice any difference in output). I'm trying to use fixtures to switch databases; the file store would carry over untouched in this case.

Anyway, I'll close here and continue in the original issue.