def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') # gender = request.form.get('gender','1') # hobby = request.form.getlist('hobby') # department = request.form.getlist('department') # img = request.files.get('img') # if img: # print img.filename # img.save('/tmp/kk.txt') # print request.form # print gender # print hobby # print department #检查用户信息是否合法 _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: user.add_user(username, password, age) #检查ok,添加用户信息 flash("用户%s添加成功!" % username) return redirect('/users/') #跳转到用户列表 else: #跳转到用户新建页面,回显错误信息&用户信息 return render_template('user_create.html', \ error=_error, username=username, \ password=password, age=age)
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') _session_id = session['id']['id'] _session_username = session['user']['username'] # gender = request.form.get('gender','1') # hobby = request.form.getlist('hobby') # department = request.form.getlist('department') # img = request.files.get('img') # if img: # print img.filename # img.save('/tmp/kk.txt') # print request.form # print gender # print hobby # print department #检查用户信息是否合法 _is_ok, _error = user.validate_add_user(_session_username, username, password, age) if _is_ok: user.add_user(username, password, age) #检查ok,添加用户信息 #flash("用户%s添加成功!" %username) #return redirect('/users/') #跳转到用户列表 return json.dumps({'is_ok': _is_ok, "error": _error})
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') gender = request.form.get('gender', '1') hobby = request.form.getlist('hobby') img = request.files.get('img') if img: print img.filename img.save('/tmp/kk.txt') print request.form print gender print hobby #检查用户信息 _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: user.add_user(username, password, age) #检查ok,添加用户信息 return redirect(url_for('users', msg='新建成功')) #跳转到用户列表url_for else: #跳转到用户新建页面,回显错误信息&用户信息 return render_template('user_create.html', \ error=_error, username=username, \ password=password, age=age)
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') gender = request.form.get('gender', '1') hobby = request.form.getlist('hobby') img = request.files.get('img') if img: print img.filename img.save('./test.img') print request.form print gender print hobby _is_ok, _error = user.validate_add_user(username, password, age) #检查用户信息 if _is_ok: user.add_user(username, password, age) #添加用户信息 flash('添加用户信息成功') return redirect('/users/') #跳转到用户列表 else: return render_template('user_create.html', username=username, password=password, age=age, error=_error)
def create_user(): username = request.form.get('user-username', '') password = request.form.get('user-password', '') age = request.form.get('user-userage', '') _is_ok, _error = user.validate_add_user(username, password, age) #检查用户信息 if _is_ok: user.add_user(username, password, age) #添加用户信息 return json.dumps({'is_ok': _is_ok, "error": _error})
def commituser(): #userid = request.form.get('id') username = request.form.get('adduser') age = request.form.get('addage') password = request.form.get('password') _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: #外部模块user.validate_user判断用户信息True执行 user.add_user(username, password, age) return json.dumps({'is_ok': _is_ok, 'error': _error})
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') #检查用户信息 _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: user.add_user(username, password, age) #检查ok,添加用户信息 return json.dumps({'is_ok': _is_ok, "error": _error}) '''
def add_user(): username= request.form.get("username","") password= request.form.get("password","") age= request.form.get("age","") _is_ok,_error = user.validate_add_user(username,password,age) if _is_ok: user.add_user(username,password,age) flash("添加用户信息成功") return redirect('/users/') else: return render_template('user_create.html', info=_error)
def add_user(): username = request.form.get('username','') password = request.form.get('password','') age = request.form.get('age','') _is_ok,_error = user.validate_add_user(username,password,age) if _is_ok: user.add_user(username,password,age) flash('新建成功!') return redirect('/users/') #return redirect(url_for('users',msg='新建成功')) else: return render_template('create_user.html',error=_error,username=username,password=password,age=age)
def user_add(): params = request.args if request.method == 'GET' else request.form username = params.get('username') password = params.get('password') age = params.get('age') job = params.get('job') if request.method == 'GET': return render_template('user/user_add.html') else: # 检查用户信息 is_ok, error = user.validate_add_user(username=username, age=age, password=password,job=job) if is_ok: user.add_users(username=username, age=age, password=password, job=job) return json.dumps({'is_ok': is_ok, 'error': error})
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') #检查用户信息 _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: user.add_user(username, password, age) #检查ok,添加用户信息 return redirect(url_for('users', msg='新建成功')) #跳转到用户列表url_for else: #跳转到用户新建页面,回显错误信息&用户信息 return render_template('user_create.html', \ error=_error, username=username, \ password=password, age=age)
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') #检查用户信息 _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: user.add_user(username, password, age) #检查ok,添加用户信息 return redirect(url_for('users', msg='新建成功')) #跳转到用户列表url_for else: #跳转到用户新建页面,回显错误信息&用户信息 return render_template('user_create.html', \ error=_error, username=username, \ password=password, age=age)
def commituser(): #userid = request.form.get('id') username = request.form.get('adduser') age = request.form.get('addage') password = request.form.get('password') _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: #user.validate_user(username,password,age): #外部模块user.validate_user判断用户信息True执行 user.add_user(username, password, age) return redirect('/users/') else: # 检查不通过 提示信息 return render_template('adduser.html', error=_error, adduser=username, addage=age, password=password)
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') #检查用户信息是否合法 _is_ok, _error = user.validate_add_user(username, password, age) if _is_ok: user.add_user(username, password, age) #检查ok,添加用户信息 flash("用户%s添加成功!" %username) return redirect('/users/') #跳转到用户列表 else: #跳转到用户新建页面,回显错误信息&用户信息 return render_template('user_create.html', \ error=_error, username=username, \ password=password, age=age)
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') _is_ok, _error = user.validate_add_user(username, password, age) #检查用户信息 if _is_ok: user.add_user(username, password, age) #添加用户信息 flash('添加用户信息成功') return redirect('/users/') #跳转到用户列表 else: return render_template('user_create.html', username=username, password=password, age=age, error=_error)
def add_user(): username = request.form.get("username",'') password = request.form.get("password",'') age = request.form.get('age','') # gender = request.form.get("gerder",'0') # hobby = request.form.getlist('hobby') # img = request.files.get("img") # if img: # print img.filename # img.save('/tmp/dick.txt') # print request.form # print gender # print hobby #检查用户信息 _is_ok,_error = user.validate_add_user(username,password,age) if _is_ok: user.add_user(username,password,age) return json.dumps({'_is_ok':_is_ok,'error':_error})
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') phone = request.form.get('phone', '') email = request.form.get('email', '') img = request.files.get('img') if img: print img.filename img.save('/tmp/kk.txt') print request.form #检查用户信息 _is_ok, _error = user.validate_add_user(username, password, age, phone, email) if _is_ok: user.add_user(username, password, age, phone, email) #检查ok,添加用户信息 return json.dumps({'is_ok': _is_ok, 'error': _error}) #跳转到用户列表url_for else: #跳转到用户新建页面,回显错误信息&用户信息 return json.dumps({'is_ok': _is_ok, 'error': _error})
def user_add(): params = request.args if request.method == 'GET' else request.form username = params.get('username') password = params.get('password') age = params.get('age') job = params.get('job') if request.method == 'GET': return render_template('user/user_add.html') else: is_ok, error = user.validate_add_user(username=username, age=age, password=password, job=job) if is_ok: user.add_users(username=username, age=age, password=password, job=job) flash(u'添加:%s 成功' % username) return redirect('/user/list/') else: return render_template('user/user_add.html', error=error)
def add_user(): username = request.form.get('username', '') password = request.form.get('password', '') age = request.form.get('age', '') phone = request.form.get('phone', '') email = request.form.get('email','') img = request.files.get('img') if img: print img.filename img.save('/tmp/kk.txt') print request.form #检查用户信息 _is_ok, _error = user.validate_add_user(username, password, age, phone, email) if _is_ok: user.add_user(username, password, age, phone, email) #检查ok,添加用户信息 return json.dumps({'is_ok': _is_ok, 'error':_error}) #跳转到用户列表url_for else: #跳转到用户新建页面,回显错误信息&用户信息 return json.dumps({'is_ok': _is_ok, 'error':_error})