39 | 39 |
photo_upload = load_template("photo_upload")
|
40 | 40 |
photo_list = load_template("photo_list")
|
41 | 41 |
photo_tile = load_template("photo_tile")
|
| 42 |
photo_delete = load_template("photo_delete")
|
42 | 43 |
view_photo = load_template("view_photo")
|
43 | 44 |
|
44 | 45 |
edit_pages = load_template("edit_pages")
|
|
220 | 221 |
return flask.redirect("/edit/photo")
|
221 | 222 |
id = int(flask.request.form["id"])
|
222 | 223 |
file = flask.request.files["file"]
|
223 | |
photo_id = db.add_photo(file, id)
|
| 224 |
photo_id = model.Photo.upload(file, id)
|
224 | 225 |
if id == -1:
|
225 | |
return flask.redirect(f"/edit/view-photo/{photo_id:09}")
|
| 226 |
return flask.redirect(f"/edit/view-photo/{photo_id}")
|
226 | 227 |
else:
|
227 | |
return flask.redirect(f"/edit/design/{id:09}")
|
| 228 |
return flask.redirect(f"/edit/design/{photo_id}")
|
228 | 229 |
|
229 | 230 |
|
230 | 231 |
@app.route("/edit/photo/<id>/")
|
231 | 232 |
@main
|
232 | 233 |
def modify_photo(id):
|
233 | |
design_id = flask.requests.args["design_id"]
|
234 | |
return "Delete Photo", Templates.photo_delete(id, design_id)
|
| 234 |
design_id = flask.request.args.get('design_id', -1)
|
| 235 |
return "Delete Photo", Templates.photo_delete({
|
| 236 |
"id": id,
|
| 237 |
"design_id": design_id
|
| 238 |
})
|
235 | 239 |
|
236 | 240 |
|
237 | 241 |
@app.route("/edit/photo/<id>/", methods=["POST"])
|
238 | 242 |
def do_modify_photo(id):
|
239 | |
design_id = int(flask.request.form["design_id"])
|
240 | |
db.delete_photo(id)
|
241 | |
return flask.redirect(f"/edit/design/{design_id}/")
|
| 243 |
model.Photo.get(filename=id).delete_instance()
|
| 244 |
if (d_id := int(flask.request.form.get('design_id', -1))) != -1:
|
| 245 |
return flask.redirect(f"/edit/design/{d_id}/")
|
| 246 |
else:
|
| 247 |
return flask.redirect(f"/edit/design/")
|
242 | 248 |
|
243 | 249 |
|
244 | 250 |
@app.route("/edit/view-photo/")
|