Beispiel #1
0
def articletypeadd():
    if request.method == 'GET':
        return render_template('articletype/add.html',id= uuid.uuid4().__str__())
    form = request.form
    articletype = ArticleType()
    articletype.name = form.get('name')
    articletype.describe = form.get('describe')
    articletype.user_id = g.user.id
    db.session.add(articletype)
    db.session.commit()
    flash('添加成功!')
    return redirect(location='/articletype')
Beispiel #2
0
def artiletypeupdate():
    if request.method =='GET':
        id = request.args['id']
        print id
        articleType = ArticleType.query.filter_by(id=id).first()
        print articleType.name
        return render_template('articletype/update.html',articleTypeentity=articleType)
    form = request.form
    articletype = ArticleType()
    print form.get('oid')
    articletype =  ArticleType.query.filter_by(id=form.get('oid')).first()
    articletype.name = form.get('name')
    articletype.describe = form.get('describe')
    articletype.user_id = g.user.id
    db.session.commit()
    flash('修改成功!')
    return redirect(location='/articletype')