django-photologue icon indicating copy to clipboard operation
django-photologue copied to clipboard

Add programmatic functionality for uploading zip file

Open lausek opened this issue 3 years ago • 1 comments
trafficstars

Hey maintainers,

first of all: Thanks your effort! You're keeping this project useful and alive!

I wanted to have a programmatic way of uploading zip files to the database. Something I could use inside the Django shell. At the moment, I'm utilizing UploadZipForm but it feels kind of clunky and it doesn't support setting a specific publishing date on the Gallery.

This PR refactors UploadZipForm.save into a new function:

def upload_photos_to_site(
    site: Site,
    zip: ZipFile,
    gallery: Gallery,
    photo_defaults: PhotoDefaults
) -> List[UploadMessage]:
    ...

TODO

  • Code formatting (Is there an automatic tool for this? Maybe black?)

lausek avatar May 19 '22 19:05 lausek

Hello and thanks for the PR. Apologies for the delay in answering.

You code looks great. I like your idea of a separate upload method, and I like your use of typing. The only thing I'd want to change is dataclasses, as they might break Photologue for some users.

richardbarran avatar Jun 23 '22 20:06 richardbarran

Hi Lausek - sorry for the delay. Your code looks great, I've merged it.

richardbarran avatar Aug 08 '22 20:08 richardbarran