From b00631bd3e3fe6ccf5e906838c9f91840ac46c21 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 22 Nov 2018 11:22:31 +0000 Subject: [PATCH] Add a delete button. --- sourcing/templates/view.html | 32 +++++++++++++++++++++++++++++++- sourcing/view.py | 8 ++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/sourcing/templates/view.html b/sourcing/templates/view.html index e47dd8e..a18e9d5 100644 --- a/sourcing/templates/view.html +++ b/sourcing/templates/view.html @@ -4,6 +4,9 @@ {% block content %} +{% set subject_count = doc.subjects.count() %} +{% set can_delete = subject_count == 0 %} + {% if current_user.is_authenticated and doc.user == current_user %} {% set title = doc.title_from_link() %} + +{% if can_delete %} + +{% endif %} + {% endif %} {% if doc.type != 'sourcedoc' %} @@ -64,6 +92,9 @@

{{ self.title() }} {% if current_user.is_authenticated and doc.user == current_user %} + {% if can_delete %} + + {% endif %} {% endif %}

{% if version %} @@ -132,7 +163,6 @@

References

- {% set subject_count = doc.subjects.count() %} {% if subject_count %}

There are {{ subject_count }} documents that refer to this {{ doc.type }}.