Boolean 'Complete' field in my form is not working from UpdateView in Django

This is the code that I have written. I am facing an issue in implementing the boolean checkbox functionality from UpdateView in Django. When I write complete.save() in below code, I am getting the desired result, but the command 'complete.save()' is getting printed on the form.

{% extends 'baseapp/main.html' %}
{% block content %}


<div class="body">
    <h3 class="header-bar" id="add-header">Add Your Task</h3>
    <form method="POST" action="">
        {%csrf_token%} <!--This is used to protect forgery requets-->
        {{form.as_p}}
        complete.save()
        <input class="search-button" type="submit" value="Submit">
        <a id="cancel-icon" href="{% url 'tasks' %}"> Cancel</a> <!--If we don't want to create an item-->
    </form>
</div>

{% endblock content %}

Output of the above code: 'complete.save()' is getting printed on the form

But, if I do not write it, the checkbox functionality doesn't work. And I redirected to the previous page. Can someone please help me out with this?

I am trying to implement the boolean field in UpdateView of Django.

Back to Top