diff options
author | luxagraf <sng@luxagraf.net> | 2023-11-15 19:25:54 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-11-15 19:25:54 -0500 |
commit | 2722e2093d31481c4ad85cf7a1b1b22be11efccd (patch) | |
tree | 4b6cf4266dd56c72f1abcd0150106a5b14c12bf8 /app/gtd | |
parent | 4f4fd5d8ab9828cc4091b3773b7dbbf6b40b87d6 (diff) |
gtd: added some delete buttons
Diffstat (limited to 'app/gtd')
-rw-r--r-- | app/gtd/templates/gtd/confirm_delete.html | 12 | ||||
-rw-r--r-- | app/gtd/templates/gtd/note_list.html | 1 | ||||
-rw-r--r-- | app/gtd/templates/gtd/project_list.html | 1 | ||||
-rw-r--r-- | app/gtd/urls.py | 16 | ||||
-rw-r--r-- | app/gtd/views.py | 20 |
5 files changed, 49 insertions, 1 deletions
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 @@ +<form method="post">{% csrf_token %} + + + + +<p>Are you sure you want to delete "{{ object }}"?</p> + + + + + <input type="submit" value="Confirm"> +</form> 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 @@ <p>{{object.body_markdown}}</p> <p class="small">For: <a href="/post/{{object.post.pk}}/notes">{{object.post}}</a></p> <p class="small">Status: <a href="/post/{{object.post.pk}}/notes">{{object.get_status_display}}</a></p> + <p class="small"><a href="{% url 'gtd:note-delete' object.pk %}">delete</a></p> </article> {% endfor%}</div> </main> 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 @@ <p>{{object.body_markdown}}</p> <p class="small">Date Goal: {{object.date_goal}}</p> <p class="small">Type: {{object.get_project_type_display}}</p> + <p class="small"><a href="{% url 'gtd:project-delete' object.pk %}">delete</a></p> </article> {% endfor%}</div> </main> 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 @@ -32,6 +32,11 @@ urlpatterns = [ name="note-edit" ), path( + r'note/<pk>/delete', + views.GTDNoteDeleteView.as_view(), + name="note-delete" + ), + path( r'projects', views.GTDProjectListView.as_view(), name="project-list" @@ -52,6 +57,11 @@ urlpatterns = [ name="project-edit" ), path( + r'projects/<pk>/delete', + views.GTDProjectDeleteView.as_view(), + name="project-delete" + ), + path( r'wirednote', views.WiredNoteListView.as_view(), {'status':None}, @@ -72,7 +82,11 @@ urlpatterns = [ views.WiredNoteUpdateView.as_view(), name="wirednote-edit" ), - + path( + r'wirednote/<pk>/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" |