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

Admin upload not displaying in Django 3.2 for versions 2+

Open tammyalexandra opened this issue 3 years ago • 3 comments

In the admin the S3 direct upload form is not showing up -- it should appear in the space to the right of "Local image:" in the screenshot below:

image

All the markup for the element does appear in the source of the page. I discovered that the CSS from /static/s3direct/dist/index.css appears to be hiding it (what you see below is the CSS straight from the file; it was not modified by any JS that ran on the page).

image

Downgrading django-s3direct to 1.1.8 but keeping Django 3.2 restored the functionality of django-s3direct. No version of django-s3direct 2.0 or above works. Working versions suggest that JS runs after the page loads to display the form elements. I am not getting any JS errors in the browser.

I do not have any custom code running in my admin, and I confirmed that all my code and configuration matches the documentation for the newer versions of django-s3direct.

Thanks for any help you can provide untangling this.

tammyalexandra avatar Jun 17 '22 00:06 tammyalexandra

Does the example work for you? (with Django 3.2). I just tried it and couldn't recreate the issue.

bradleyg avatar Jun 17 '22 08:06 bradleyg

Managed to recreate. Could you try again with the latest version?

bradleyg avatar Jun 17 '22 10:06 bradleyg

Good news -- the form elements now show up and the image successfully gets uploaded. Thank you!

Bad news -- even after the image gets uploaded, the buttons to save the model containing the image are not un-grayed.

Screen Shot 2022-06-17 at 11 34 03 AM

I see a couple messages in the browser console likely related to whatever is happening:

  • 404 on a POST to https://s3.us-east-1.amazonaws.com/my/image/path/file.png?uploadId=pkF8elVd7Nz64.SpalcXqg4RrbEidbKFPIo5ICkFljOMoe35CpsKiZ6j_Mj7TZWE3OOthTzGZfRKbgA._zODqQ--
  • And then after that, complete error: my/image/path/file.png AWS Code: NoSuchUpload, Message:The specified upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed.status:404

I can confirm that https://s3.us-east-1.amazonaws.com/my/image/path/file.png is the file that was just successfully uploaded, & I can bring up in the image in my browser.

Thanks for your ongoing help with this!

tammyalexandra avatar Jun 17 '22 15:06 tammyalexandra