From 2722e2093d31481c4ad85cf7a1b1b22be11efccd Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 15 Nov 2023 19:25:54 -0500 Subject: gtd: added some delete buttons --- app/gtd/templates/gtd/confirm_delete.html | 12 ++++++++++++ app/gtd/templates/gtd/note_list.html | 1 + app/gtd/templates/gtd/project_list.html | 1 + app/gtd/urls.py | 16 +++++++++++++++- app/gtd/views.py | 20 ++++++++++++++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 app/gtd/templates/gtd/confirm_delete.html (limited to 'app/gtd') diff --git a/app/gtd/templates/gtd/confirm_delete.html b/app/gtd/templates/gtd/confirm_delete.html new file mode 100644 index 0000000..8e657b1 --- /dev/null +++ b/app/gtd/templates/gtd/confirm_delete.html @@ -0,0 +1,12 @@ +
{% csrf_token %} + + + + +

Are you sure you want to delete "{{ object }}"?

+ + + + + +
diff --git a/app/gtd/templates/gtd/note_list.html b/app/gtd/templates/gtd/note_list.html index 2e4ea0a..203906b 100644 --- a/app/gtd/templates/gtd/note_list.html +++ b/app/gtd/templates/gtd/note_list.html @@ -13,6 +13,7 @@

{{object.body_markdown}}

For: {{object.post}}

Status: {{object.get_status_display}}

+

delete

{% endfor%} diff --git a/app/gtd/templates/gtd/project_list.html b/app/gtd/templates/gtd/project_list.html index a37f4e8..cba8944 100644 --- a/app/gtd/templates/gtd/project_list.html +++ b/app/gtd/templates/gtd/project_list.html @@ -13,6 +13,7 @@

{{object.body_markdown}}

Date Goal: {{object.date_goal}}

Type: {{object.get_project_type_display}}

+

delete

{% endfor%} diff --git a/app/gtd/urls.py b/app/gtd/urls.py index 10ae61f..95d7acf 100644 --- a/app/gtd/urls.py +++ b/app/gtd/urls.py @@ -31,6 +31,11 @@ urlpatterns = [ views.GTDNoteUpdateView.as_view(), name="note-edit" ), + path( + r'note//delete', + views.GTDNoteDeleteView.as_view(), + name="note-delete" + ), path( r'projects', views.GTDProjectListView.as_view(), @@ -51,6 +56,11 @@ urlpatterns = [ views.GTDProjectUpdateView.as_view(), name="project-edit" ), + path( + r'projects//delete', + views.GTDProjectDeleteView.as_view(), + name="project-delete" + ), path( r'wirednote', views.WiredNoteListView.as_view(), @@ -72,7 +82,11 @@ urlpatterns = [ views.WiredNoteUpdateView.as_view(), name="wirednote-edit" ), - + path( + r'wirednote//delete', + views.WiredNoteDeleteView.as_view(), + name="wirednote-delete" + ), path( r'post', views.WiredPostListView.as_view(), diff --git a/app/gtd/views.py b/app/gtd/views.py index 06728f0..2fb419e 100644 --- a/app/gtd/views.py +++ b/app/gtd/views.py @@ -102,6 +102,13 @@ class GTDProjectListView(ListView): return context +class GTDProjectDeleteView(DeleteView): + # specify the model you want to use + model = GTDProject + success_url ="/gtd/projects" + template_name = "gtd/confirm_delete.html" + + class GTDNoteTODOView(ListView): model = GTDNote template_name = "gtd/note_list.html" @@ -162,6 +169,13 @@ class WiredNoteListView(ListView): return context +class WiredNoteDeleteView(DeleteView): + # specify the model you want to use + model = WiredNote + success_url ="/gtd/wirednote" + template_name = "gtd/confirm_delete.html" + + class WiredPostListView(ListView): model = WiredPost template_name = 'gtd/post_table.html' @@ -204,6 +218,7 @@ class WiredPostNotesView(DetailView): context['notes'] = self.get_object().wirednote_set.all().order_by("status") return context + class WiredPostUpdateView(UpdateView): model = WiredPost form_class = WiredPostUpdateForm @@ -219,3 +234,8 @@ class WiredPostUpdateView(UpdateView): return reverse('gtd:posts-detail', kwargs={"pk": self.object.pk}) +class GTDNoteDeleteView(DeleteView): + # specify the model you want to use + model = GTDNote + success_url ="/gtd/notes" + template_name = "gtd/confirm_delete.html" -- cgit v1.2.3-70-g09d2