From b78b82bb19547b7c966e1dbb8e943d1d8b233692 Mon Sep 17 00:00:00 2001 From: Sketch <75850871+SketchMaster2001@users.noreply.github.com> Date: Sun, 1 Oct 2023 21:19:19 -0400 Subject: [PATCH] Allow for deletion for posters --- asset_data.py | 5 +++++ templates/poster_list.html | 2 +- theunderground/posters.py | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/asset_data.py b/asset_data.py index 6a6df4a7..5818a37e 100644 --- a/asset_data.py +++ b/asset_data.py @@ -2,6 +2,8 @@ from typing import Union from wtforms import FileField +import os + class RoomLogoAsset(Asset): """Used for a company logo within a room.""" @@ -85,6 +87,9 @@ def __init__(self, seq: int, is_theatre: bool): self.asset_dir = self.base_asset_dir / asset_dir self.asset_name = asset_name + def delete(self): + os.remove(self.asset_path()) + class PayMovieAsset(Asset): def __init__(self, seq: int): diff --git a/templates/poster_list.html b/templates/poster_list.html index b26bfc93..40d8c7a9 100644 --- a/templates/poster_list.html +++ b/templates/poster_list.html @@ -40,7 +40,7 @@
-
+
diff --git a/theunderground/posters.py b/theunderground/posters.py
index ed9cf61b..63272066 100644
--- a/theunderground/posters.py
+++ b/theunderground/posters.py
@@ -1,6 +1,7 @@
from flask import render_template, flash, url_for, redirect
from flask_login import login_required
from theunderground.forms import PosterForm
+from theunderground.operations import manage_delete_item
from asset_data import PosterAsset
from models import Posters, db
from room import app
@@ -44,6 +45,20 @@ def add_poster():
return render_template("poster_add.html", form=form)
+@app.route("/theunderground/posters/