Skip to content

Commit 06c8c8d

Browse files
committed
Full delete removes image from disk
1 parent fa1ea6a commit 06c8c8d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/api/undo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from flask_restplus import Namespace, Resource, reqparse
22
from flask_login import login_required, current_user
33

4+
import os
45
import datetime
56
from ..models import *
67

@@ -100,6 +101,9 @@ def delete(self):
100101
if model_object is None:
101102
return {"message": "Invalid id"}, 400
102103

104+
if isinstance(model_object, ImageModel):
105+
os.remove(model_object.path)
106+
103107
model_object.delete()
104108

105109
return {"success": True}

0 commit comments

Comments
 (0)