I need to send arg to my flask function but I have 'missing 1 required positional argument' error. What I should do to solve this problem.
check = True
@app.route('/sortbysalary', methods=['POST'])
def sortbysalary(check):
if request.method == 'POST':
if check is True:
conn = sqlite3.connect('employees.db')
c = conn.cursor()
with conn:
# no case carre
c.execute("SELECT * FROM employee ORDER BY pay COLLATE NOCASE DESC")
query = c.fetchall()
check = False
print(check)
else:
conn = sqlite3.connect('employees.db')
c = conn.cursor()
with conn:
# no case carre
c.execute("SELECT * FROM employee ORDER BY pay COLLATE NOCASE ASC")
query = c.fetchall()
check = True
print(check)
return render_template('show.html', query=query)
Aucun commentaire:
Enregistrer un commentaire