From: Guillaume Pellerin Date: Sat, 8 Aug 2026 23:12:12 +0000 (+0200) Subject: better s3 flaging X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=83b0a22c5f3914dac779125780333a2d9ebb66dc;p=teleforma.git better s3 flaging --- diff --git a/teleforma/management/commands/teleforma-export-conferences-s3.py b/teleforma/management/commands/teleforma-export-conferences-s3.py index 82a4b5f1..810414e8 100644 --- a/teleforma/management/commands/teleforma-export-conferences-s3.py +++ b/teleforma/management/commands/teleforma-export-conferences-s3.py @@ -55,10 +55,13 @@ class Command(BaseCommand): s3_exported=False, status=3, ) + for conference in conferences: + s3_exported = False + for media in conference.media.all(): - if media.file: + if media.file and not media.file_s3: media_file = media.file.path filename = os.path.split(media_file)[1] if os.path.exists(media_file): @@ -67,8 +70,9 @@ class Command(BaseCommand): media.set_mime_type() media.save() logger.logger.info(media_file) + s3_exported = True - if media.poster_file: + if media.poster_file and not media.poster_file_s3: poster_file = media.poster_file.path filename = os.path.split(poster_file)[1] if os.path.exists(poster_file): @@ -76,7 +80,9 @@ class Command(BaseCommand): media.poster_file_s3.save(filename, File(f)) media.save() logger.logger.info(poster_file) + s3_exported = True - conference.s3_exported = True - conference.save() + if s3_exported: + conference.s3_exported = True + conference.save()