Django view list of items making them editable
I am listing the rows of a table (fields: Name, Emails, Category, Expiry) via a template:
<table border="1" style="width:100%">
<tr>
<th style="width:20%">Name</th>
<th style="width:40%">Emails</th>
<th>Category</th>
<th>Expiry </th>
<th>Action</th>
</tr>
{% for obj in expiredlist %}
<tr>
<td>{{obj.name}}</td>
<td>{{obj.emails}}</td>
<td>{{obj.category}}</td>
<td>{{obj.expiry}}</td>
</tr>
{% endfor %}
</table>
Now I want to allow users to edit one of the fields on the fly (like how we do it in datatable). I tried to add a new column by adding:
<td><form method="post">
{{form.expiry}}
</form>
<input type="submit" value="Submit"></td>
Thinking that the above will allow users to edit expiry field on the fly. I know I am not passing any info about each row (not able to connect with id). Can someone guide me how can I do this?