Fix bug that prevented editing alt-text
* If there was already an uploaded file, it doesn't get re-uploaded when editing, and doesn't show up in request.FILES. The file name is still in thought.media so we can use that to tell if there's a image and if we should allow media_alt
This commit is contained in:
parent
4c2251a460
commit
6408c3db55
|
@ -88,7 +88,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
const mediaInput = document.getElementById("id_media");
|
||||
const mediaAlt = document.getElementById("id_media_alt");
|
||||
const clearCheckbox = document.getElementById("media-clear_id");
|
||||
|
|
|
@ -143,8 +143,9 @@ def post(request):
|
|||
], check=True)
|
||||
os.remove(os.path.join(settings.MEDIA_ROOT, f"{thought.uuid}.m4a")) # Remove the original file
|
||||
thought.media.name = f"{thought.uuid}.aac" # Update the file in the DB
|
||||
else:
|
||||
# We need to make sure that if we remove an image, the alt text is removed with it
|
||||
|
||||
# We need to make sure that if we remove an image, the alt text is removed with it
|
||||
if not thought.media:
|
||||
thought.media_alt = ""
|
||||
|
||||
# Save for real
|
||||
|
|
Loading…
Reference in New Issue