0

I'm using flask to make a scheduler app. I have a function that will take a list of college courses from the url and schedule them. Is there any way to make a form that people could enter the classes in as opposed to using the url?

My view function:

@app.route('/sched/<some_list>')
def scheduleMe(some_list):
    course_list = some_list.split(',')
    my_combos = scheduler.schedule(course_list)
    return render_template("sched.html", title="Scheduler", combos=my_combos)

takes in a list of courses such as BT 353,CS 135,HHS 468,BT 181,CS 146,CS 284 and returns a page with all the possible schedules for those courses.

I'm trying to make some sort of form where if a user entered the courses above it would redirect them to www.mysite.com/sched/<courses they enter>. I was going to use GET and then basically make a view function that was take the resulting url from the form and pull the courses out of the query.

Is there a better/ more direct way to do this?

Thanks!

Josh Gribbon
  • 75
  • 1
  • 15

1 Answers1

0

This might not be the best way to answer a question on stackoverflow. Flask does provide a redirect option to another url. Also check url_for. For more on forms, you can look here.

Community
  • 1
  • 1
Vivek Anand
  • 621
  • 1
  • 7
  • 15