I am passing a variable in html to a view and it works without the
/<int:id>/
template:
<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:
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/ |
Using the URLconf defined in m28t.urls
, Django tried these URL patterns, in this order:
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']