예제 #1
0
파일: views.py 프로젝트: samlabs821/app
def add_node():
    form = NodeForm()
    if request.method == 'POST' and form.validate_on_submit():
        ids = form.Id.data
        is_group = form.IsGroup.data
        name_en = form.NameEN.data
        name_ru = form.NameRU.data
        name_kz = form.NameKZ.data
        print type(is_group)
        if is_group == '0':
            doc_type = form.DocTypeCode.data
            mail = form.DecMail.data
            print 'not group'
        elif is_group == '1':
            doc_type=''
            mail=''
            print 'group'
        org = Organization()
        org.initialize(ids,doc_type, name_en, name_ru, name_kz, mail, is_group)
        update_org_by_id(ids, org)
        return redirect('/nodes')
    return render_template('node_add.html', title='Add server', form=form)