Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin file upload with blank=True fails due to a missing file #286

Closed
herrbenesch opened this issue Mar 5, 2024 · 0 comments
Closed

Admin file upload with blank=True fails due to a missing file #286

herrbenesch opened this issue Mar 5, 2024 · 0 comments

Comments

@herrbenesch
Copy link
Contributor

herrbenesch commented Mar 5, 2024

Hey there, thank you for this useful project.

I'm using
django ==5.0.3
django-s3file ==5.5.5
django-storages ==1.14.2

I'm using django-pictures with django-s3file to serve and store my images.
I have a model field setup like so

    image = PictureField(
        _("image"),
        upload_to=FilePattern(
            filename_pattern=("fancy-pattern),
        ),
        aspect_ratios=["1/1"],
        storage=some_s3_storage,
        blank=True,
        file_types=["WEBP", "JPEG"],
        width_field="image_width",
        height_field="image_height",
    )

Now if I try to save an instance of the model in the admin, I'm getting the following error message:

TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
  at Function.from(<anonymous>)
  at uploadFiles(/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:164)
  at ? (/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:2879)
  at Array.forEach(<anonymous>)
  at uploadS3Inputs(/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:2835)
  at HTMLFormElement.<anonymous>(/static/s3file/js/s3file.min.7bb6c3f3de1e.js:1:3350)

If I remove blank=True from the model definition, the upload works without a problem.
Do you have an idea what is wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant