Python class-based-view updateview not get saved

Hey guys I am new in programming I am trying to make a website for Todo by using Python-django. I am using Django Class Based Update View to make edit in datas. But while I am click on submit button its not get saved

class TaskUpdateView(UpdateView):
model = Task
fields = "__all__"
template_name = 'update.html'
context_object_name = 'task'
success_url = reverse_lazy('cbvhome')



<form method="post" class=" justify-content-center align-items-center mb-4 ps" enctype="multipart/form-data">
                    {% csrf_token %}
                    <div class="mb-3">
                      <label for="task-id" class="form-label  me-5">Task</label>
                      <input type="text" name="name" class="form-control" id="task-id" aria-describedby="emailHelp" style="width: 80%;" placeholder="Enter your Task Here" value="{{}}">
                    <div class="mb-3">
                        <label for="exampleFormControlTextarea1" class="form-label me-5">Enter the details</label>
                        <textarea class="form-control" name="details" id="task-detail"rows="2" placeholder="Enter the task details" style="width: 80%;">{{task.details}}</textarea>
                    <div class="mb-3">
                      <label for="task-date" class="form-label  me-5">Date set curerntly: {{}}</label>
                      <input type="date" name="date" class="form-control" id="task-date" style="width: 80%;" value="{{}}">
                    <div class="mb-3 mt-3">
                        <label for="task-prio" class="form-label  me-5">Select the priority</label>
                        <select class="form-select" name="priority" aria-label="Default select example" style="width: 80%;" id="task-prio" value="{{task.priority}}">
                            <option selected>{{task.priority}}</option>
                            <option value="Very Urgent" class="text-danger">Very Urgent</option>
                            <option value="Urgent" class="text-warning">Urgent</option>
                            <option value="Important" class="text-primary">Important</option>
                    <div class="submit pe-5" style="padding-left: 100px; padding-top: 10px;" >
                    <input type="submit" class="btn btn-outline-success me-5" value="Save">

By default if nothing is given in url params, so it is considered as str type, so define it as int:


It will be better if you give action="{% url 'cbvupdate' %}" in form tag of HTML although not necessary as Django always takes current page route.

Note: Always add / at the end of every route.

Back to Top