From ada383c81a230b8afc849f3ab43e647c38fc61a3 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Sat, 3 Jan 2026 01:30:51 -0500 Subject: [PATCH] redefined & added arguments to existing FBVs in apps.dashboard.views; added new FBV to add to-do items to existing lists; added capture groups to some paths in .urls (tho these are now due for DRY refactor); django templating added to form action in templates/apps/dashboard/list.html; DashViewTest(), NewListTest() & NewItemTest() refactored for dynamic ids in .tests --- apps/dashboard/tests.py | 53 +++++++++++++++++++++++++----- apps/dashboard/views.py | 15 ++++++--- core/urls.py | 3 +- templates/apps/dashboard/list.html | 2 +- 4 files changed, 58 insertions(+), 15 deletions(-) diff --git a/apps/dashboard/tests.py b/apps/dashboard/tests.py index d342526..8a85b66 100644 --- a/apps/dashboard/tests.py +++ b/apps/dashboard/tests.py @@ -41,24 +41,32 @@ class ListAndItemModelsTest(TestCase): class DashViewTest(TestCase): def test_uses_list_template(self): - response = self.client.get('/apps/dashboard/the-only-list-in-the-world/') + mylist = List.objects.create() + response = self.client.get(f'/apps/dashboard/{mylist.id}/') self.assertTemplateUsed(response, 'apps/dashboard/list.html') def test_renders_input_form(self): - response = self.client.get('/apps/dashboard/the-only-list-in-the-world/') - self.assertContains(response, '
') + mylist = List.objects.create() + response = self.client.get(f'/apps/dashboard/{mylist.id}/') + self.assertContains( + response, + f'', + ) self.assertContains(response, '/', views.view_list, name='view_list'), + path('apps/dashboard//add-item', views.add_item, name='add_item'), ] diff --git a/templates/apps/dashboard/list.html b/templates/apps/dashboard/list.html index 58585ad..61a1703 100644 --- a/templates/apps/dashboard/list.html +++ b/templates/apps/dashboard/list.html @@ -4,7 +4,7 @@

Your To-Do List

- + {% csrf_token %}