title: How can I "redirect" to another URL and pass a list object using Flask
body: <p>I have a very basic question regarding URL changes.
  Let's assume I have a HTML page <code>http://example.com/create</code> that conatins a form with some input fields. From this input fields I want to create a python list which should be used to generate another HTML page <code>http://example.com/show_list</code> containing a list based on the python's list values. </p>
  
  <p>So the view for <code>http://example.com/create</code> is:</p>
  
  <pre><code>@app.route('/create', methods=['GET', 'POST']) 
  def create():
  
  if request.method == 'POST':
      some_list = parse_form_data_and_return_list(...)
      return render_template( "show_list.html", some_list=some_list)  #here's the problem!
  
  return render_template( "create.html")
  </code></pre>
  
  <p>Assume that <code>parse_form_data_and_return_list(...)</code> takes the user input and returns a list with some <code>string</code> values.
  I added a comment to the line that troubles me. I'll come back to it in a second but first give you the template of the page (<code>http://example.com/show_list</code>) that should be loaded AFTER the user input:</p>
  
  <pre><code>{% block content %}
  &lt;ul class="list"&gt;       
    {% for item in some_list %}
      &lt;li&gt;
          {{ item }}
      &lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  {% endblock content %}
  </code></pre>
  
  <p>Basically this works fine. The list values are "passed" to the Jinja template and the list is shown.</p>
  
  <p>If you now again have a look to my route method you can see that I am only doing <code>render_template</code> to show the <code>shwo_list</code> page. For me this has one disadvantage. The URL will not be changed to <code>http://example.com/show_list</code>, but will stay at <code>http://example.com/create</code>. </p>
  
  <p>So I thought about creating a own <code>route</code> for <code>show_list</code> and in the <code>create()</code> method calling <code>redirect</code> instead of rendering the next template directly. Like this:</p>
  
  <pre><code>@app.route('/show_list')
  def tasklist_foo():
  return render_template( "show_list.html" )
  </code></pre>
  
  <p>But in this case I don't see how I could pass the <code>list</code> object to <code>show_list()</code>. I could of course parse every single item of the list to the URL (hence post it to <code>http://example.com/show_list</code>), but that's not what I want to do.</p>
  
  <p>As you already might have recognized, I'm pretty new to web developing. I guess I just use a wrong pattern or haven't found a simple API function that does the trick. So I kindly ask you to show me a way to solve my problem (shortly summerized): render the <code>show_list</code> template and change the URL from <code>http://example.com/create</code> to <code>http://example.com/show_list</code> using the list created in the <code>create()</code> method/route.</p>