title: Python Flask-WTF - use same form template for add and edit operations
body: <p>I'm just getting started with Flask / Flask-WTF / SQLAlchemy, and most example CRUD code I see shows separate templates for adding / editing. It seems repetitive to have two templates with almost identical form html (e.g. books_add.html, books_edit.html). Conceptually it makes more sense to me to have one template, something like "books_form.html", and just call render_template on that same template from two separate route definitions. I'm not quite sure how to accomplish it though, something like:</p>
  
  <pre><code>@app.route('/books/add')
  def add_book():
  ...
  render_template('books_form.html', action = 'add')
  
  
  @app.route('/books/edit/&lt;id&gt;')
  def edit_book(id):
  ...
  render_template('books_form.html', action = 'edit', id = id)
  </code></pre>
  
  <p>but I'm not sure if I'm on the right track, or deviating from best practice. Any input is appreciated - specific thoughts on how to handle the single template file to deal with either add or edit behavior. Links to examples are welcome as well.</p>
  
  <p>Thanks! </p>