diff --git a/app.py b/app.py index baea018..f8e61cf 100644 --- a/app.py +++ b/app.py @@ -249,12 +249,14 @@ def loeschen(): except TypeError: return "Irgendwas ist GANZ falsch", 400 try: - with open(dateiNameFürListe(liste), "x") as f: + with open(dateiNameFürListe(liste), "r+") as f: songs = json.load(f) if len(songs) < song + 1: return "Das Lied Gibt es Nicht", 400 del songs[song] + f.seek(0) json.dump(songs, f, indent=2, ensure_ascii=False) + f.truncate() return redirect("/remove?liste=" + liste, 303) except FileNotFoundError: return "Die Liste Ist nicht da (Du kannst Sie anlegen)", 400 diff --git a/templates/index.html b/templates/index.html index 1eacd58..a3e2788 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,10 +1,10 @@