Answer the question
In order to leave comments, you need to log in
How to add a button to each table row using django_tables2?
Good evening.
Without using Django_tables2 , the button was added to the table like this:
templates:
{%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'])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question