title: Advanced: How to use href in Jinja2
body: <p>I want to use <code>href</code> in the <code>jinja2</code> template to send the user to the the specific result based on <code>id</code> to learn more about that particular result. I created a <code>route</code> url : <code>('view_assessment_result', '/view_assessment_result/{id}')</code> that renders all the details about the specific result based on <code>id</code>. </p>
  
  <p><strong>What I want to do: <br></strong>
  When a user clicks on the <code>ID</code> number, they will be sent to the route <code>view_assessment_result/{some_id}</code> that will render the specifics of that page based on the <code>id</code> found in the iteration <code>for a in assessment...</code>. 
  I tried looking into cases, but others seem to be using <a href="https://stackoverflow.com/questions/11665401/jinja-is-there-any-built-in-variable-to-get-current-html-page-name">Flask</a>, which I am NOT using. The template code below is not accomplishing the task at hand. </p>
  
  <p>See code below:</p>
  
  <p><strong>route config:</strong></p>
  
  <pre><code>    #Route convention: resource 'name' 'url dispath'
      config.add_route('view_assessment_result', '/view_assessment_result/{id}')
  </code></pre>
  
  <p><strong>jinja template</strong></p>
  
  <pre><code>        &lt;tr&gt;
          {% for a in assessment_results %}
                  &lt;td&gt;&lt;a href="{{ '/view_assessment_result' }}"&gt;{{ a.id }}&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;{{ a.owner }}&lt;/td&gt;
              &lt;td&gt;{{a.assessment }}&lt;/td&gt;
          &lt;/tr&gt;
          {% endfor %}
  </code></pre>
  
  <p><strong>view configuration that renders specific result sent by <code>href</code> above:</strong> </p>
  
  <pre><code>@view_config(route_name='view_assessment_result', request_method='GET', renderer='templates/analyst_view.jinja2')
  def view_assessment_result(request):
      with transaction.manager:
          assessment_result_id = int(request.matchdict['id'])
          assessment_result = api.retrieve_assessment_result(assessment_result_id)
          if not assessment_result:
              raise HTTPNotFound()
      #more code
  </code></pre>