Task Reordering

#1. To Make TodoList Sortable by Using sortable.js NPM package.

To achieve TodoList Sortable perform the below instruction

  1. Include the npm package(via cdn) in task_list.html

  2. Include a script to perform the Sortable TodoList

#2 To make sortable TodoList permanent.

  1. Setting unique key for each task using HTML attribute called data-position="{{task.pk}}"

  2. Define a hidden form to get the unique keys as input to perform task list to reordering in permanent.

  3. To write a script to collect the actual unique keys of the tasks list:

For every drag and drop of task list, above function is invoked.

From the function, after collecting unique keys from the current todolist and store it in pos list variable.

  1. Getting collected unique keys using input tag

  2. We cannot process the above form data in django so we have to create forms.py file

    todo/forms.py

  3. Now write a django view to process the reordering operation

  4. Mapping the task-reordering url

Last updated