title: Flask template Not rendered, and insertion to the database doesn't happen
body: <p>I am making a template that shows a description of book details, The logged user can only write one review about that book, so if the user didn't make a review the "review.html" template shows him the information about the book plus a form for him to enter his review and rating, and if already submitted his review, it shows him the information plus his review in a bootstrap list form. when I submit the review, nothing happens, the URL stays the same, but the information I submitted gets added to it, and the "success.html" template as entended.</p>
  
  <blockquote>
    <p>Application.py</p>
  </blockquote>
  
  <pre><code>@app.route("/books/&lt;int:book_id&gt;", methods=["GET", "POST"])
  def review(book_id):
      ''' Prints to user Full information about a book + API information + prompts for user's review. '''
  
      # Get book information from books table using book_id got from books.html
      bookInfo = db.execute("SELECT * FROM books WHERE id=:book_id", {"book_id": book_id}).fetchone()
  
      # Error handling.
      if bookInfo is None:
          raise RuntimeError("Error @ route: review, didn't fetch book information from books table.")
  
      # Need ISBN from books template.
      res = requests.get("https://www.goodreads.com/book/review_counts.json", params={"key": "RXTP9fIaG5qVUetlVTHgQ", "isbns": f"{bookInfo['isbn']}"})
  
      if res is None:
          raise RuntimeError("Error @ route: reveiw, Error in goodReads API.")
  
      # Convert API response to JSON format.
      bookInfo2 = res.json()
  
      # GoodReads API values.
      averageRating = bookInfo2["books"][0]["average_rating"]
      ratingsCount = bookInfo2["books"][0]["ratings_count"]
  
      # Check if the user made a review
      haveReview = db.execute("SELECT * FROM reviews WHERE user_id=:user_id", {"user_id": session["user_id"]}).fetchone()
  
      if haveReview is None:
  
          if request.method == "POST":
  
              # User review and rating.
              review = request.form["review"]
              rating = int(request.form["rating"])
  
              if db.execute("INSERT INTO reviews (user_id, book_id, review_text, review_rating)\
                             values (:user_id, :book_id, :review_text, :review_rating)",\
                             {"user_id": 1, "book_id": book_id, "review_text": review,\
                             "review_rating": int(rating)}) is None:
  
                             raise RuntimeError("Error @ route review, didn't insert into reviews table.")
              else:
                  db.commit()
                  return render_template("success.html")
  
          return render_template("review.html",bookInfo=bookInfo,averageRating=averageRating,ratingsCount=ratingsCount,\
                                 makeReview="0")
  
  
  
      return render_template("review.html",bookInfo=bookInfo,averageRating=averageRating,ratingsCount=ratingsCount, \
                            haveReview=haveReview,makeReview="1")
  
  </code></pre>
  
  <blockquote>
    <p>review.html</p>
  </blockquote>
  
  <pre><code>{%extends "base.html"%}
  
  {%block title%}Review{%endblock%}
   &lt;!-- {%block var2%}{{url_for('register')}}{%endblock%} --&gt;
  
  
  {%block body%}
  
  &lt;!-- Book details, and user's review --&gt;
  &lt;div class="container"&gt;
  &lt;dl class="row"&gt;
  &lt;dt class="col-sm-3"&gt;Book title&lt;/dt&gt;
  &lt;dd class="col-sm-9"&gt;{{bookInfo.title}}&lt;/dd&gt;
  
  &lt;dt class="col-sm-3"&gt;Book author&lt;/dt&gt;
  &lt;dd class="col-sm-9"&gt;{{bookInfo.author_name}}&lt;/dd&gt;
  
  &lt;dt class="col-sm-3"&gt;ISBN&lt;/dt&gt;
  &lt;dd class="col-sm-9"&gt;{{bookInfo.isbn}}&lt;/dd&gt;
  
  &lt;dt class="col-sm-3"&gt;Publication year&lt;/dt&gt;
  &lt;dd class="col-sm-9"&gt;{{bookInfo.publish_year}}&lt;/dd&gt;
  
  &lt;dt class="col-sm-3"&gt;GoodReads average Rating&lt;/dt&gt;
  &lt;dd class="col-sm-9"&gt;{{averageRating}}&lt;/dd&gt;
  
  &lt;dt class="col-sm-3"&gt;Goodreads number of ratings&lt;/dt&gt;
  &lt;dd class="col-sm-9"&gt;{{ratingsCount}}&lt;/dd&gt;
  &lt;/div&gt;
  
  {%if makeReview == '1'%}
  &lt;div class="container"&gt;
    &lt;dl class='row'&gt;
    &lt;dt class="col-sm-3"&gt;Your rating&lt;/dt&gt;
    &lt;dd class="col-sm-9"&gt;{{haveReview.review_rating}} &lt;/dd&gt;
  
   &lt;dt class="col-sm-3"&gt;Your review&lt;/dt&gt;
   &lt;dd class="col-sm-9"&gt; {{haveReview.review_text}}&lt;/dd&gt;
  &lt;/div&gt;
  
  {%elif makeReview == '0'%}
    &lt;form class="container"&gt;
    &lt;div class="form-group"&gt;
      &lt;label for="review"&gt;Your Review&lt;/label&gt;
      &lt;textarea class="form-control" id="review" name="review" placeholder="Submit a review." rows="3"&gt;&lt;/textarea&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
      &lt;label for="rating"&gt;Your rating&lt;/label&gt;
      &lt;input type="number" class="form-control" id="rating" name="rating" placeholder="Submit a rating."&gt;
    &lt;/div&gt;
    &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
    &lt;/form&gt;
  {%endif%}
  
  {%endblock%}
  
  </code></pre>