def delete_post(): if session.get('logged_in') is not None: accountDao = AccountDao() ownerMatched = accountDao.remove_account_post(session['logged_in'], request.form['id']) if not ownerMatched: return redirect(url_for('PetCare.list_posts')) postDao = PostDao() postDao.remove_post(request.form['id']) return redirect(url_for('PetCare.list_posts'))
def delete_post(): if session.get('logged_in') is not None: accountDao = AccountDao() ownerMatched = accountDao.remove_account_post(session['logged_in'], request.form['postId']) if not ownerMatched: return redirect(url_for('PetCare.list_posts')) postDao = PostDao() prevImages = postDao.remove_post(request.form['postId']) for img in prevImages: ImageHandler.delete_image(img) return redirect(url_for('PetCare.list_posts'))