title: Passing Variables in Python, Flask
body: <p>I am trying to understand Python and passing variables. I am trying to pass an id for an 'action'. I can create the action and see the is there but I do not understand how to take the id and pass it from one form to another. If anyone could point me in the right direction would be great.</p>
  
  <p>Views.py</p>
  
  <pre><code>#g.user.nickname passes in the nickname for a refernce
  @app.route('/edit', methods=['GET', 'POST'])
  @login_required
  def edit():
      form = EditForm(g.user.nickname)
      if form.validate_on_submit():
          g.user.nickname = form.nickname.data
          g.user.about_me = form.about_me.data
          db.session.add(g.user)
          db.session.commit()
          flash('Your changes have been saved.')
          return redirect(url_for('edit'))
      elif request.method != "POST":
          form.nickname.data = g.user.nickname
          form.about_me.data = g.user.about_me
      return render_template('edit.html', form=form)
  
  #Don't understand how to create a variable to pass a reference from post.html 
  @app.route('/action_request', methods=['GET', 'POST'])
  @login_required
  def action_requests():
      form = EditReqForm()
      return render_template('action_request.html',
                              form=form)
  </code></pre>
  
  <p>Post.html</p>
  
  <pre><code>&lt;table class="table table-hover"&gt;
      &lt;tr&gt;
  
          &lt;td&gt;
              &lt;p&gt;Raised by &lt;a href="{{ url_for('user', nickname=action.author.nickname) }}"&gt;{{ action.raised_by }} &lt;/a&gt;on
                  {{ action.date_raised.strftime('%d-%m-%Y') }}:&lt;/p&gt;
              #Trying to generate reference of action id to pass to ActionReqForm
              &lt;p&gt;&lt;a href="{{ url_for('action_requests', id=action.id)}}"&gt;&lt;strong&gt;
                  Issue:&lt;/strong&gt;{{
                  action.issue }}&lt;/a&gt;&lt;/p&gt;
              &lt;p&gt;&lt;strong&gt;Source: {{action.id}}&lt;/strong&gt;{{ action.source }}&lt;/p&gt;
  
              &lt;p&gt;&lt;strong&gt;Immediate Action: &lt;/strong&gt;{{ action.immediate_action }}&lt;/p&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>