# Passing int from html button to view gets url error

**URL:** <https://forum.djangoproject.com/t/passing-int-from-html-button-to-view-gets-url-error/24556>\
**Category:** Getting Started\
**Created:** [October 16, 2023, 7:00pm UTC](https://forum.djangoproject.com/t/passing-int-from-html-button-to-view-gets-url-error/24556 "2023-10-16T19:00:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jslovern391](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jslovern391/32/16283_2.png) [@jslovern391](https://forum.djangoproject.com/u/jslovern391)\
**Post date:** [October 16, 2023, 7:00pm UTC](https://forum.djangoproject.com/t/passing-int-from-html-button-to-view-gets-url-error/24556/1 "2023-10-16T19:00:13Z")

</div>

I am passing a variable in html to a view and it works without the

```auto
/<int:id>/

```

template:

```auto
<body>
    {% block body %}
    <h1>{{ user.alias_name }}</h1>      
      <h2>Fishes</h2>
      <table class="table table-striped table-bordered">
        <thead class="thread-dark thread-center" >
            <tr>
                <th scope="col">Email</th>
                <th scope="col">M28t Name</th>
                <th scope="col">Active</th>
                <th scope="col">Make Fisher</th>
            </tr>
        </thead>
        <tbody>
            {% for fish in fish %}
            <tr>
                <td>{{ fish.alias_name }}</td>
                <td><button type="submit">Email</button></td>
                <td>{% if fish.is_active == True %}
                        Active
                    {% else %}
                        <button type="submit">Resend Activation</button>
                    {% endif %}
                </td>
                <td><form action="{% url 'fisher_button'{{fish.id}} %}"><button type="submit"></button>Make Fisher</form></td>
            </tr>
            {% empty %}
            <h4>No fish yet.</h4>
            {% endfor %}
        </tbody>
        </table>
    {% endblock body %}
</body>
</html>

```

URL path:

```auto
path('fisher_button/<int:id>/', views.fisher_button, name='fisher_request_sent'),

```

Error

# Page not found (404)

| Request Method: | GET |
| --- | --- |
| Request URL: | [http://127.0.0.1:8000/accounts/fisher\_button/](http://127.0.0.1:8000/accounts/fisher_button/) |

Using the URLconf defined in `m28t.urls`, Django tried these URL patterns, in this order:

```auto
1. admin/
2. [name='index']
3. accounts/ signup/<str:alias_name> [name='signup.html']
4. accounts/ activate/<uidb64>/<token>/ [name='activate']
5. accounts/ account_activation_sent/ [name='account_activation_sent']
6. accounts/ account_activation_complete/ [name='account_activation_complete']
7. accounts/ accept_sponsorship/<uidb64>/<token>/ [name='accept_sponsorship']
8. accounts/ accept_sponsorship_complete/<kwargs>/ [name='accept_sponsorship_complete']
9. accounts/ fisher_button/<int:id>/ [name='fisher_request_sent']

```

---

<div class="post-metadata">

**Author:** ![foxy4096](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/foxy4096/32/29065_2.png) [@foxy4096](https://forum.djangoproject.com/u/foxy4096)\
**Post date:** [October 16, 2023, 7:21pm UTC](https://forum.djangoproject.com/t/passing-int-from-html-button-to-view-gets-url-error/24556/2 "2023-10-16T19:21:05Z")

</div>

> [@jslovern391](#):
>
> `{% url 'fisher_button'{{fish.id}} %}`

It should be `{% url 'fisher_button' fish.id %}`

---

<div class="post-metadata">

**Author:** ![jslovern391](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jslovern391/32/16283_2.png) [@jslovern391](https://forum.djangoproject.com/u/jslovern391)\
**Post date:** [October 16, 2023, 7:27pm UTC](https://forum.djangoproject.com/t/passing-int-from-html-button-to-view-gets-url-error/24556/3 "2023-10-16T19:27:20Z")

</div>

Worked. Thanks much!
