Reputation: 3779
I have a template as below (the second column of the table is wrong, which is my question):
{% for thing in things %}
<tr><td>See the lovely {{ thing.name }}!</td>
<td><form method="POST" action="">
{% csrf %}
<input type="hidden" name="id" value="{{ thing.id }}">
<input type="submit" name="submit" value="Kill me!">
</form></td>
</tr>
{% endfor %}
And I'm a bit stumped how to make an array of forms like this. Of course, the above form works great modulo the csrf
, so maybe all I need to do is figure out how to make the csrf work in that context and then I think I can just look at request.POST.get('id')
(I think...).
Many thanks for any pointers.
Upvotes: 0
Views: 40