How to transfer edit method of an ID to a button/links in Django?
<p>This is the code in my ulrs.py</p>

<pre><code>url(r'^viewguides/detail/(?P&lt;id&gt;\d+)/edit/$', views.post_update, name='update'),
</code></pre>

<p>Now I want to make it look like this:</p>

<pre><code>&lt;a href="/detail/(?P&lt;id&gt;\d+)/edit" class="btn btn-default btn-lg" style="background-color: transparent;"&gt;&lt;font color="Orange"&gt; EDIT &lt;/font&gt;&lt;/a&gt;&lt;hr&gt;
</code></pre>

<p>So that I can edit the certain ID that I want to. But it gives me an error. How do you do it? or is there any other way? I'm new to Django.</p>

<p>You must use the url tag in your template, something like this:</p>

<pre><code>&lt;a href="{% url update guide.id %}"&gt;EDIT&lt;/a&gt;
</code></pre>

<p>Where "update" is the <code>name</code> found in urls.py and "guide" the instance you want to update.</p>

python django python-2.7 django-templates django-views