{%for query in query_all % }
<tr>
<td>
<form method ="POST"><%csrf token%>
<button type="submit"' name="name_of_button" value="{{query.id}}">text</button>
</form>
</td>
</tr>
{%endfor %}
views:
if 'name_of_button' in request.POST:
func(request.POST['name_of_button'])