我正在使用发布请求存储数据,但是每当我单击提交时,我的代码中都会出现此错误,提示“分配前局部变量“密码”引用”。我已经检查了所有的缩进。@app.route('/admin/new_nurse', methods=['GET','POST'])@login_requireddef create_nurse(): form=NurseForm() x=time.strftime("%H:%M:%S") if (x>=('00:00:00')and x<=('11:59:59')): x=(str('Good Morning')) elif x>=('12:00:00')and x<=('15:59:59'): x=(str('Good Afternoon')) elif x>=('16:00:00')and x<=('23:59:59'): x=(str('Good Evening')) if form.validate_on_submit(): if form.picture.data: picture_file = save_picture(form.picture.data) firstname=request.form['fname'] surname=request.form['sname'] date_of_birth=request.form['dob'] age_of_nurse=request.form['age'] sex_option=request.form['sexoption'] nurse_telephone=request.form['telnumber'] educational_status=request.form['educationalstatus'] Postal_Address=request.form['postaladdress'] House_No=request.form['houseno'] locality=request.form['locality'] dept=request.form['dpt'] username=form.username.data email=form.email.data password=form.password.data relative_info=request.form['relative'] hashed_password= bcrypt.generate_password_hash(password).decode('utf-8')
添加回答
举报
0/150
提交
取消