diff --git a/main/templates/whispermaphone/post.html b/main/templates/whispermaphone/post.html index 951336f..b20a512 100644 --- a/main/templates/whispermaphone/post.html +++ b/main/templates/whispermaphone/post.html @@ -88,7 +88,6 @@ } }); - const mediaInput = document.getElementById("id_media"); const mediaAlt = document.getElementById("id_media_alt"); const clearCheckbox = document.getElementById("media-clear_id"); diff --git a/main/views.py b/main/views.py index 7119ef1..f99f994 100644 --- a/main/views.py +++ b/main/views.py @@ -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