I have generated html delete button dynamically to add at the end of each row in a table depending on the data that comes in. Buttons are generated and added at the end of each to delete that particular row. Apart from the table, there is also a form on the page with a submit button at the end. Buttons that appear on page load for some reason trigger a post event to validate the form on the page. When I add a new row in the table dynamically, delete button works normally to delete a row but when I refresh this behaves as a normal submit button. I am not able to figure out the reason why its behaving strangely that way. Any help would be greatly appreciated. Here is my html.
.html
<tbody>
    {% for item in items %}
    <tr>
        <form action="{% url 'newitem' %}" role="form" method="post">
            {% csrf_token %}
            <th> {{ item.id }} <input type="hidden" name="item_id" value="{{ item.id }}" > </th>
            <td> {{ item.Name }} </td>
            <td> 
                {% buttons %}                                   
                    <input type="submit" name="action" value="Delete" class="btn btn-danger btn-xs" style="width: 50px" />                          
                {% endbuttons %}
            </td>
        </form>
    </tr>
    {% endfor %}
</tbody>
