I have a function to genereate new courses as below which takes 0 args if the course is new & 5 if it has just attempted to be created but failed validation.
The route:
@app.route('/courses/new')
def new_course(*args):
if len(args) == 5:
...
else:
...
The caller:
...
return redirect(url_for('new_course', int(request.form['id']), course_code, semester, year, student_ids))
I get the error message url_for() takes 1 argument (6 given). Or if I try:
...
return redirect(url_for('new_course', args[int(request.form['id']), course_code, semester, year, student_ids]))
I get the error message new_course() takes 5 arguments (0 given)
What am I doing wrong?