implement photo deletion
Getty Ritter
4 years ago
| 221 | 221 | else: |
| 222 | 222 | return flask.redirect(f'/edit/design/{id:09}') |
| 223 | 223 | |
| 224 | # def POST(self): | |
| 225 | # input = web.input(file={}) | |
| 226 | # try: | |
| 227 | # id = int(input['id']) | |
| 228 | # except: | |
| 229 | # raise web.redirect('/design/') | |
| 230 | # if 'file' in input: | |
| 231 | # photo_id = db.add_photo(input['file'], id) | |
| 232 | # if id == -1: | |
| 233 | # raise web.redirect('/edit/view-photo/{0:09}/'.format(photo_id)) | |
| 234 | # else: | |
| 235 | # raise web.redirect('/edit/design/{0:05}/'.format(id)) | |
| 236 | ||
| 237 | 224 | @app.route("/edit/photo/<id>/") |
| 238 | 225 | @main |
| 239 | 226 | def modify_photo(id): |
| 241 | 228 | return 'Delete Photo', Templates.photo_delete(id, design_id) |
| 242 | 229 | |
| 243 | 230 | @app.route("/edit/photo/<id>/", methods=["POST"]) |
| 244 | def do_modify_photo(): | |
| 245 | pass | |
| 246 | ||
| 247 | # def POST(self, id): | |
| 248 | # input = web.input() | |
| 249 | # design_id = int(input['design_id']) | |
| 250 | # db.delete_photo(id) | |
| 251 | # raise web.redirect('/edit/design/{0:05}/'.format( | |
| 252 | # design_id)) | |
| 231 | def do_modify_photo(id): | |
| 232 | design_id = int(flask.request.form['design_id']) | |
| 233 | db.delete_photo(id) | |
| 234 | return flask.redirect(f'/edit/design/{design_id}/') | |
| 253 | 235 | |
| 254 | 236 | @app.route("/edit/view-photo/") |
| 255 | 237 | @main |
| 298 | 280 | title = flask.request.form.get('title', slug.capitalize()) |
| 299 | 281 | db.set_page(slug, title, text) |
| 300 | 282 | return flask.redirect(f'/edit/pages/{slug}') |
| 301 | ||
| 302 | # def POST(self, name): | |
| 303 | # input = web.input() | |
| 304 | # text = input.get('text', '') | |
| 305 | # title = input.get('title', name.capitalize()) | |
| 306 | # db.set_page(name, title, text) | |
| 307 | # raise web.redirect('/edit/pages/{0}/'.format(name)) | |
| 308 | ||
| 309 | # class edit_about: | |
| 310 | ||
| 311 | ||
| 312 | # @main | |
| 313 | # def GET(self): | |
| 314 | # return ( | |
| 315 | # 'Edit About', | |
| 316 | # render.edit_about(db.get_about_text())) | |
| 317 | ||
| 318 | ||
| 319 | # def POST(self): | |
| 320 | # input = web.input() | |
| 321 | # text = input.get('text', '') | |
| 322 | # db.set_about_text(text) | |
| 323 | # raise web.redirect('/edit/about/') | |
| 324 | 283 | |
| 325 | 284 | |
| 326 | 285 | # urls = ( |