Last active
March 11, 2026 19:55
-
-
Save SophieShears/0eaf1ec98af2117480976ee978c994db to your computer and use it in GitHub Desktop.
change download file_path from url to absolute path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from submissions.models import * | |
| dl_ids = list(Download.objects.filter(file_path__contains='https://', service__in=['SC', 'IS', 'IH']).values_list('id', flat=True)) | |
| for dl_id in dl_ids: | |
| download = Download.objects.get(id=dl_id) | |
| split_filepath = download.file_path.split('insta_rw') | |
| after_filepath = f'/mnt/storage47-1/layer_1400_vids/instagram_stories/videos{split_filepath[-1]}' | |
| download.file_path = after_filepath | |
| download.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment