Jinja2 Specify Route REST Type
<p>My question is can I specify the type of REST route in Jinja2, for example if I have the route:</p>

<pre><code>RedirectRoute('/&lt;id&gt;/somthing/&lt;key&gt;', myFile.Handler, name='name', strict_slash=True),
</code></pre>

<hr>

<pre><code>class Handler(JSONHandler):
  def get(): ...
  def delete(): ...
  def post(): ...
</code></pre>

<hr>

<pre><code>&lt;a href="{{ uri_for('name', id=id, key=key) }}" target="_blank"&gt;Delete&lt;/a&gt;
</code></pre>

<p>Is it possible to specify the <code>delete()</code> handler form the Jinja2 template?</p>

<p>If I understand what you're asking, you have an endpoint which respond to the methods GET, POST, and DELETE and you want to know if you can make the HTML resulting from Jinja send a DELETE request your endpoint.</p>

<p>The short answer is no. DELETE must always be performed by JavaScript and AJAX. The only methods you can specify in an HTML are GET (via a link) and POST (via a form).</p>

python html jinja2