From 93c4e2a0b977a7005ec688cbd7ac246cc41afafd Mon Sep 17 00:00:00 2001 From: j Date: Mon, 24 Mar 2025 11:50:53 +0000 Subject: [PATCH] merge photolog subfolder patch --- photologue/forms.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/photologue/forms.py b/photologue/forms.py index 1468f98..9e6937c 100644 --- a/photologue/forms.py +++ b/photologue/forms.py @@ -166,14 +166,6 @@ def upload_photos_to_site(site: Site, zip: zipfile.ZipFile, gallery: Gallery, ph logger.debug(f'Ignoring file "{filename}".') continue - if os.path.dirname(filename): - logger.warning('Ignoring file "{}" as it is in a subfolder; all images should be in the top ' - 'folder of the zip.'.format(filename)) - upload_messages.append(UploadMessage.warning( - _('Ignoring file "{filename}" as it is in a subfolder; all images should be in the top folder of the ' - 'zip.').format(filename=filename))) - continue - data = zip.read(filename) if not len(data): @@ -213,7 +205,7 @@ def upload_photos_to_site(site: Site, zip: zipfile.ZipFile, gallery: Gallery, ph continue contentfile = ContentFile(data) - photo.image.save(filename, contentfile) + photo.image.save(os.path.basename(filename), contentfile) photo.save() photo.sites.add(site) gallery.photos.add(photo)