def delete_tweet(): try: tweet_id = request.form['tweet_id'] Tweet.delete_tweet(tweet_id) flash('Your Tweet was successfully deleted', 'success') return redirect('/profile') except: flash(app.config['ERROR_MSG'].format('Could not delete tweet!'), 'danger') return redirect('/profile')