duncaningram / django-fixture-media

load/dump Django model fixtures with their media files
MIT License
11 stars 6 forks source link

loaddata expects media files to be in random fixture folder #8

Open johanneswilm opened 10 years ago

johanneswilm commented 10 years ago

I try to load a fixture from the local path,. The corresponding "media" folder is in the same directory. Yet this here seems to just pick one of the apps that has a fixture folder and expects the media folder to be in there.

https://github.com/duncaningram/django-fixture-media/blob/master/fixturemedia/management/commands/loaddata.py#L30-L37

markpasc commented 10 years ago

Ah, yeah, I didn't plan for specifying fixtures by path, only discovering them in the fixture paths.

Looks like we could wrap loaddata.load_label() to set per-label (path or fixture name) fixture_media_paths to fix this. That would still confuse some media paths (when the same label refers to different fixtures in different fixture paths that use the same media filepaths), but those files will clash in the project's live MEDIA_PATH anyway.