Esempio n. 1
0
def add_post():
    status_code = 0
    error_msg = 'error'
    try:
        ins = Post()
        ins.title = getparms('title','')
        ins.id = str( uuid.uuid4())
        ins.summary = getparms('summary','')
        ins.content = getparms('content','')
        ins.join_date = datetime.now()
        ins.status = 1
        ins.sort_num = getparms('sort_num',0)
        ins.save()
        status_code = 1
        error_msg = '成功'
    except Exception as e:
        error_msg = '出错了 %r' % e
    result = {'status_code':status_code,'msg':error_msg }
    return  jsonify(result)