From b1fcdea49385f7a4d9eb726f5e492c1afc42135a Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Tue, 7 Jan 2025 21:13:28 -0300 Subject: [PATCH] better representiation of delete/edit notes --- action/views.py | 1 - device/templates/details.html | 25 ++++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/action/views.py b/action/views.py index 125b656..0bdac32 100644 --- a/action/views.py +++ b/action/views.py @@ -73,7 +73,6 @@ class AddNoteView(View): class UpdateNoteView(UpdateView): model = Note fields = ['description'] - template_name = "blank.html" pk_url_kwarg = 'pk' def form_valid(self, form): diff --git a/device/templates/details.html b/device/templates/details.html index 1ed0789..08d9506 100644 --- a/device/templates/details.html +++ b/device/templates/details.html @@ -27,15 +27,19 @@ {{ note.date|timesince }} {% trans "ago" %} - + {% if user == note.user or user.is_admin %} + {% trans "Editable" %} +
{% else %} +
{% endif %}

@@ -69,18 +73,25 @@ - +

- {% csrf_token %} -
- - {% trans 'Confirm delete' %} - + {% csrf_token %} +
+
+

{% trans 'Are you sure you want to delete this note?' %}

+ + {% trans 'Confirm delete' %} + +
{% endif %}