为 `app/api_1_0/controller` 下的 `user.py` 控制器做删除操作
1. 查询对象
2. 删除对象
3. 提交会话
```
from app.api_1_0 import bp
from app.api_1_0.model.user import UserModel
from app import db
from flask import jsonify
@bp.route('/user', methods=['POST'])
def add_user():
pass
@bp.route('/user', methods=['GET'])
def list_user():
pass
@bp.route('/user', methods=['PUT'])
def update_user():
pass
@bp.route('/user', methods=['DELETE'])
def delete_user():
try:
user_obj = UserModel.query.get(2)
db.session.delete(user_obj)
db.session.commit()
except Exception as e:
db.session.rollback()
return '删除失败'
return '删除成功'
```
测试
![通过模型删除](https://img.kancloud.cn/fc/2e/fc2e5f4d02b0eb4d36573d4dfda23ae0_573x34.png)