title: Jinja2 templates If condition not working correctly
body: <p>I have an if-statement in a Jinja2 template in <code>complete.html</code>, but it doesn't run the right code regardless if the if-condition is True or False. </p>
  
  <p>I call a redirect url to another view function which then renders it, carrying the variable that determines the condition of the if-loop. I printed out the condition and it's correct, but the if-loop doesn't run the correct code. Am I missing something that is causing the if-statement to not work correctly.</p>
  
  <p>My code:</p>
  
  <p><code>view.py</code></p>
  
  <pre><code>@app.route('/', methods=['GET', 'POST'])
  def home():
      form = CourseForm()
  
      if form.validate_on_submit():
          course_name = form.cname.data.upper()
          course_id = form.cid.data
          course_sec = form.sec.data.upper()
          email = form.email.data.lower()
          reserved = form.reserved.data
  
          result = checkCourse(course_name, course_id, course_sec)
          if result is not None:
              flash('Unable to find course')
          else:
              known = False
              course = Course.query.filter_by(cname=course_name, cid=course_id, sec=course_sec).first()
              if course is None:
                  course = Course(cname=course_name, cid=course_id, sec=course_sec)
                  db.session.add(course)
                  db.session.flush()
                  user = User(email=email, course_id=course.id, reserved=reserved)
                  db.session.add(user)
              else:
                  ckey = course.id
                  result = checkUser(email, ckey, reserved)
                  if result != None:
                      known = True
                  else:
                      user = User(email=email, course_id=ckey, reserved=reserved)
                      db.session.add(user)
              db.session.commit()
              return redirect(url_for('complete', known=known))
      return render_template('home.html', form=form)
  
  @app.route('/complete')
  def complete():
      known = request.args.get('known', type=string)
      app.logger.debug(known)
      return render_template('complete.html', known=known)
  </code></pre>
  
  <p>Templates:</p>
  
  <p><code>base.html</code></p>
  
  <pre><code>{% extends "bootstrap/base.html" %}
  
  {% block title %}UBC Course Alert{% endblock %}
  
  {% block styles %}
  {{super()}}
  &lt;link rel="stylesheet"
        href="{{url_for('.static', filename='home.css')}}"&gt;
  {% endblock %}
  
  {% block content %}
  &lt;div class="jumbotron"&gt;
      &lt;div class="container"&gt;
          {% block page_content %}{% endblock %}
      &lt;/div&gt;
  &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p><code>complete.html</code></p>
  
  <pre><code>{% extends "base.html" %}
  {% import "bootstrap/wtf.html" as wtf %}
  
  {% block page_content %}
  
  &lt;p&gt;
  {% if known %}
    You already added this course. You'll receive a email as soon as there's space :)
  {% else %}
    Thanks for registering your course, you'll receive a email as soon as there's space!
  {% endif %}
  &lt;/p&gt;
  
  {% endblock %}
  </code></pre>