{% csrf_token %}
<div class="card mt-4">
    <div class="card-header">
        To Do
    </div>
    <div class="card-body">
        <div class="form-row">
            <div class="col-md-10">{{ to_do_form.to_do }}</div>
            <div class="col-md-2"><input type="submit" value="Add To Do" for="id_to_do" class="btn btn-primary form-control"></div>
        </div>
        {% if to_do_results %}
            <table class="table table-striped table-hover mt-4">
                <thead>
                    <tr>
                        <td>To Do</td>
                        <td>------</td>
                    </tr>
                </thead>
                {% for row in to_do_results %}
                    <tr>
                        <td>{{ row.to_do }}</td>
                        <td id="to_do_{{ row.to_do_id }}" >
                            {% if row.to_do_completed %}
                                Completed
                            {% else %}
                                <a href="javascript:void(0)" onclick="complete_to_do({{ row.to_do_id }})">Click to Complete</a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
            </table>
        {% endif %}
    </div>
</div>