From 3c3018d4eef1cfab657c2d6b8f8789f8b7bfcc71 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 2 Oct 2020 11:57:31 +0200 Subject: Container: warning message about associated finds, containers on deletion --- .../ishtar/wizard/wizard_container_deletion.html | 58 ++++++++++++++++++++++ archaeological_warehouse/wizards.py | 3 ++ 2 files changed, 61 insertions(+) create mode 100644 archaeological_warehouse/templates/ishtar/wizard/wizard_container_deletion.html (limited to 'archaeological_warehouse') diff --git a/archaeological_warehouse/templates/ishtar/wizard/wizard_container_deletion.html b/archaeological_warehouse/templates/ishtar/wizard/wizard_container_deletion.html new file mode 100644 index 000000000..ea11652af --- /dev/null +++ b/archaeological_warehouse/templates/ishtar/wizard/wizard_container_deletion.html @@ -0,0 +1,58 @@ +{% extends "ishtar/wizard/delete_wizard.html" %} +{% load i18n %} +{% block "detailed_related_info" %} + +{% if current_object.children.count %} +
+
+ {% trans "Associated containers" %} +
+
+
+
+ {% trans "Theses containers are inside this item. If you delete this item, they won't have any parent container. You probably want to fix that." %} +
+
+
    + {% for container in current_object.children.all %} +
  • {{container}}
  • {% endfor %} +
+
+
+{% endif %} +{% if current_object.finds.count or current_object.finds_ref.count %} +
+
+ {% trans "Associated finds" %} +
+
+ {% if current_object.finds.count %} +
+
+ {% trans "Theses finds are inside this item. If you delete this item, they won't be inside any container. You probably want to fix that." %} +
+
+
    + {% for find in current_object.finds.all %} +
  • {{find}}
  • {% endfor %} +
+ {% endif %} + {% if current_object.finds_ref.count %} +
+
+ {% trans "This item is the reference container for theses finds. If you delete this item, they won't have any reference container. You probably want to fix that." %} +
+
+
    + {% for find in current_object.finds_ref.all %} +
  • {{find}}
  • {% endfor %} +
+ {% endif %} +
+
+{% endif %} + +{% endblock %} diff --git a/archaeological_warehouse/wizards.py b/archaeological_warehouse/wizards.py index 9bce9381b..614e6e6be 100644 --- a/archaeological_warehouse/wizards.py +++ b/archaeological_warehouse/wizards.py @@ -179,3 +179,6 @@ class ContainerDeletionWizard(MultipleDeletionWizard): fields = ['container_type', 'reference', 'comment', 'location', 'index', 'cached_label'] redirect_url = "container_deletion" + wizard_templates = { + 'final-container_deletion': + 'ishtar/wizard/wizard_container_deletion.html'} -- cgit v1.2.3