コード例 #1
0
ファイル: routes_tweet.py プロジェクト: KiwiShow/PythonWeb
def update():
    if Tweet.check_token():
        form = request.form
        Tweet.check_id(form)
        Tweet.update(form)
        # todo Tweet update 完成之后 需要到 Tweet 的 index 页面 还是 detail 页面呢?
        return redirect(url_for('.index'))
コード例 #2
0
def update():
    token = request.args.get('token')
    if Tweet.check_token(token, gg.csrf_tokens):
        form = request.form
        Tweet.check_id(form)
        newTweet = Tweet.update(form)
        # redirect有必要加query吗
        return redirect(url_for('.index'))
コード例 #3
0
ファイル: routes_tweet.py プロジェクト: KiwiShow/PythonWeb
def edit(tweet_id):
    user = current_user()
    if Tweet.check_token():
        # tweet_id = int(request.args.get('id', -1))
        t = Tweet.find(tweet_id)
        Tweet.check_id(id=tweet_id)
        return render_template('tweet/tweet_edit.html',
                               t=t,
                               token=gg.token[user.id],
                               user=user)
コード例 #4
0
ファイル: routes_tweet.py プロジェクト: KiwiShow/PythonWeb
def delete(tweet_id):
    if Tweet.check_token():
        t = Tweet.find(tweet_id)
        Tweet.check_id(id=tweet_id)
        t.remove_with_comments(tweet_id)
        return redirect(url_for('.index'))