title: Generate UUID for Flask endpoint on page load / or in Jinja method call
body: <p>Is there a way to generate a unique UUID for a Flask endpoint (end of URL page address) only when the Flask blueprint actually generates the page?</p>
  
  <p>The following Flask blueprint code does work for me:</p>
  
  <pre><code>@street_report_blueprint.route('/', methods=['POST', 'GET'])
  def get_streetreport(reportid=uuid.uuid4().hex):
      mainselection = request.form['MainlistRadios']
      return render_template('street_reports/street_report.jinja2', mainselection=mainselection, reportid=reportid)
  </code></pre>
  
  <p><code>reportid</code> is generated as a default UUID value here in the parameter of the Flask method, and passes successfully to the webpage. (<code>{{ reportid }}</code> shows it there.)</p>
  
  <p>But if I change the route to:</p>
  
  <pre><code>@street_report_blueprint.route('/&lt;string:reportid&gt;', methods=['POST', 'GET'])
  </code></pre>
  
  <p>...then it doesn't work: Werkzeug throws a routing error along the lines of <code>Did you forget to include the UUID?</code>. I looked at
  <a href="http://werkzeug.pocoo.org/docs/0.12/routing/" rel="nofollow noreferrer">Werkzeug's URL Routing docs</a> and checked SO and Google, so I hope nobody downvotes at least.</p>
  
  <p>Or is there simple way to generate UUID and pass it inside the Jinja statement which calls the Blueprint method? Currently I have:</p>
  
  <pre><code>&lt;form class="form-horizontal" action = "{{ url_for('street_reports.get_streetreport') }}" method="post"&gt;
  </code></pre>