def photo_edit(id): photo = Photo.find_by_id(id) if not photo: return HTTPNotFound(404) form = PhotoEditForm(request.form, photo) if form.validate_on_submit(): form.populate_obj(photo) angle = float(form.rotate.data) photo.rotate_photo(angle) db.session.add(photo) db.session.commit() return redirect(url_for('house.article_edit', id=photo.post_id)) return render_template('photo_edit.html', form=form, photo=photo)
def photo_delete(id): photo = Photo.find_by_id(id) photo.delete() return redirect(url_for('house.article_edit', id=photo.post_id))