def usersedit(): if request.method == 'POST': data = request.form.to_dict() #print data user = userEdit(**data) return json.dumps({'status': 0}) else: return redirect('/users')
def users_edit(): #errmsgs = ['[User cannot be null...]','[Email type wrong...]','[Email suffix error...]','Password type error...'] if request.method == 'POST': data = request.form.to_dict() print 'form.to_dict:', data userEdit(data) ''' ret = userEdit(data) if ret in errmsgs: return render_template('users_edit.html', errmsg=ret) else: return redirect('/users') ''' return redirect('/users') if request.method == 'GET': data = request.args.get('num', '') print 'args.get:', data return render_template('users_edit.html', num=data)
def users_edit(uid): if request.method == 'POST': data = request.form.to_dict() if data['password'] != data['rpassword']: errmsg = "Confirm password error" return render_template('users_add.html', errmsg=errmsg) print data response = userEdit(uid, data) print response return redirect("/users") else: users = get_users() for user in users: if user[0] == uid: return render_template('users_edit.html', user=user)
def usersedit(uid): # () tuple response = userInfo(uid) #print response print response if request.method == 'POST': data = request.form.to_dict() #print data if data['password'] == data['rpassword']: user = userEdit(uid, **data) return redirect('/users') else: return render_template('users_edit.html', users=response, errmsg='confirm error.') else: return render_template('users_edit.html', users=response)