django-photologue
django-photologue copied to clipboard
Add programmatic functionality for uploading zip file
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?)
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.
Hi Lausek - sorry for the delay. Your code looks great, I've merged it.