Перенаправление Flask-sijax не работает
When I redirect from login method to other methods my login methods loads again instead of other methods and it is not redirected. obj_response.redirect(url_for('hr_department')) is not working. My app.py :
Что я уже пробовал:
@flask_sijax.route(app, '/login') def login(): def check(obj_response, values): print('check') result = db.session.query(Emp_Details).filter_by(ID=values['ID']).first() print(result.Password) if result is not None: if result.Password == values['Password']: records = db.session.query(Emp_Details).filter_by(ID=values['ID']).first() if records.Department == 'HR': print(records.Department) obj_response.redirect(url_for('hr_department')) elif records.Department == 'DEVELOPMENT': obj_response.redirect(url_for('devs')) else: return render_template("login.html", message="Your ID or password is invalid.") else: return render_template("login.html", message="Your ID or password is invalid.") if g.sijax.is_sijax_request: print("if") g.sijax.register_callback('check', check) return g.sijax.process_request() return render_template("login.html") @app.route('/hr_department') def hr_department(): return render_template("hr_page.html") @app.route('/devs') def devs(): return render_template("employee.html")