示例#1
0
def create():
    if request.method == 'POST':
        data = json.loads(request.get_data())
        chat = Chat()
        chat.title = data['title']
        chat.type_id = data['type_id']
        chat.content = data['content']
        chat.is_show = data['is_show']

        db.session.add(chat)
        db.session.commit()
        info = {'chat': chat.to_json()}
        return jsonify(info)