diff --git a/my_app/db.sqlite3 b/my_app/db.sqlite3 index 04162b2b..b7898f0e 100644 Binary files a/my_app/db.sqlite3 and b/my_app/db.sqlite3 differ diff --git a/my_app/todo_list/__pycache__/urls.cpython-310.pyc b/my_app/todo_list/__pycache__/urls.cpython-310.pyc index ba4449d8..425dca64 100644 Binary files a/my_app/todo_list/__pycache__/urls.cpython-310.pyc and b/my_app/todo_list/__pycache__/urls.cpython-310.pyc differ diff --git a/my_app/todo_list/__pycache__/views.cpython-310.pyc b/my_app/todo_list/__pycache__/views.cpython-310.pyc index 817a396f..a69e5a26 100644 Binary files a/my_app/todo_list/__pycache__/views.cpython-310.pyc and b/my_app/todo_list/__pycache__/views.cpython-310.pyc differ diff --git a/my_app/todo_list/templates/home.html b/my_app/todo_list/templates/home.html index b835fbe6..1ba5ae28 100644 --- a/my_app/todo_list/templates/home.html +++ b/my_app/todo_list/templates/home.html @@ -19,17 +19,17 @@ {% if things.completed %} {{ things.item }} -
{{ things.completed }}
+
Uncross
Delete
{% else %} {{ things.item }} -
{{ things.completed }}
+
Cross Off
Delete
{% endif %} {% endfor %} {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/my_app/todo_list/urls.py b/my_app/todo_list/urls.py index 138fc512..567edb1a 100644 --- a/my_app/todo_list/urls.py +++ b/my_app/todo_list/urls.py @@ -5,4 +5,7 @@ path('', views.home, name='home'), path('about/', views.about, name='about'), path('delete/',views.delete,name='delete'), + path('cross_off/',views.cross_off,name ='cross_off'), + path('uncross/',views.uncross,name ='uncross'), + ] \ No newline at end of file diff --git a/my_app/todo_list/views.py b/my_app/todo_list/views.py index c0c5bdc3..7fbc80e1 100644 --- a/my_app/todo_list/views.py +++ b/my_app/todo_list/views.py @@ -27,4 +27,17 @@ def delete(request,list_id): item = List.objects.get(pk = list_id) item.delete() messages.success(request, ('Item has been deleted!')) - return redirect('home') \ No newline at end of file + return redirect('home') + +def cross_off(request,list_id): + item = List.objects.get(pk = list_id) + item.completed = True + item.save() + return redirect('home') + +def uncross(request,list_id): + item = List.objects.get(pk = list_id) + item.completed = False + item.save() + return redirect('home') +