server.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Spent 作者: emilydowgialo 项目源码 文件源码
def remove_budget(id):
    """ Remove a budget from the database """

    # This is the budget object we are working with
    budget_at_hand = Budget.query.filter_by(id=id).first()

    # This is the user id of the user in the session
    user_id = session.get('id')

    # Check to make sure the budget is associated with the logged in user
    if user_id == budget_at_hand.budget_userid:

        # Deletes the budget item from the budget table
        db.session.delete(budget_at_hand)
        db.session.commit()

    # Redirect the user to their dashboard
    return redirect(url_for('dashboard', id=user_id))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号