T
T
tanyaa2017-07-07 18:59:29
Django
tanyaa, 2017-07-07 18:59:29

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'])

How can this be done in Django_tables2?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2017-07-07
@tanyaa

cm.
tables.TemplateColumn()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question