This is the function in views.py:
@application.route("/students/<int:id>", methods=["GET", "POST"])
def students(id):
return render_template("students.html")
I have used this code on my HTML page:
<a href="{{ url_for('students', id=student.id) }}">{{ student.id }}</a>
But url_for
is generating this:
http://127.0.0.1:5000/students?id=1
I want to generate this:
http://127.0.0.1:5000/students/1
Note that I have another function which was written before that first function:
@application.route("/students")
def students():
return render_template("students.html", students=Student.query.all())
I think url_for
is using this route.