fixing zip upload

This commit is contained in:
loulous27 2026-04-06 13:24:35 +02:00
parent 1ea7e8fc29
commit 7e900fad72

View file

@ -186,7 +186,7 @@ class GalleryDownload(LoginRequiredMixin, DetailView):
gallery_year = os.path.join("/photos/", str(gallery.date_start.year)) gallery_year = os.path.join("/photos/", str(gallery.date_start.year))
gallery_zip = os.path.join(gallery_year, (gallery.slug + ".zip")) gallery_zip = os.path.join(gallery_year, (gallery.slug + ".zip"))
with open(os.path.join(settings.MEDIA_ROOT, gallery_zip), "wb") as zip_bytes: with open(settings.MEDIA_ROOT + gallery_zip), "wb") as zip_bytes:
zip_file = zipfile.ZipFile(zip_bytes, "w") zip_file = zipfile.ZipFile(zip_bytes, "w")
for photo in gallery.photos.filter(is_public=True): for photo in gallery.photos.filter(is_public=True):
filename = os.path.basename(os.path.normpath(photo.image.path)) filename = os.path.basename(os.path.normpath(photo.image.path))