summaryrefslogtreecommitdiff
path: root/sublab_project/calendarium
diff options
context:
space:
mode:
Diffstat (limited to 'sublab_project/calendarium')
-rw-r--r--sublab_project/calendarium/admin.py2
-rw-r--r--sublab_project/calendarium/templates/calendarium/delete_confirmation.html47
2 files changed, 49 insertions, 0 deletions
diff --git a/sublab_project/calendarium/admin.py b/sublab_project/calendarium/admin.py
index b59025e..95d648c 100644
--- a/sublab_project/calendarium/admin.py
+++ b/sublab_project/calendarium/admin.py
@@ -8,6 +8,8 @@ class EventAdmin(admin.ModelAdmin):
list_filter = ('source',)
search_fields = ['name', 'description']
date_hierachy = 'start'
+ actions = None
+ delete_confirmation_template = 'calendarium/delete_confirmation.html'
def save_model(self, request, obj, form, change):
"""Sets the source to "admin".
diff --git a/sublab_project/calendarium/templates/calendarium/delete_confirmation.html b/sublab_project/calendarium/templates/calendarium/delete_confirmation.html
new file mode 100644
index 0000000..3218665
--- /dev/null
+++ b/sublab_project/calendarium/templates/calendarium/delete_confirmation.html
@@ -0,0 +1,47 @@
+{% extends "admin/base_site.html" %}
+{% load i18n %}
+
+{% block breadcrumbs %}
+<div class="breadcrumbs">
+ <a href="../../../../">{% trans "Home" %}</a> &rsaquo;
+ <a href="../../../">{{ app_label|capfirst }}</a> &rsaquo;
+ <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
+ <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo;
+ {% trans 'Delete' %}
+</div>
+{% endblock %}
+
+{% block content %}
+{% if perms_lacking or protected %}
+ {% if perms_lacking %}
+ <p>{% blocktrans with object as escaped_object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p>
+ <ul>
+ {% for obj in perms_lacking %}
+ <li>{{ obj }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% if protected %}
+ <p>{% blocktrans with object as escaped_object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktrans %}</p>
+ <ul>
+ {% for obj in protected %}
+ <li>{{ obj }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+{% else %}
+ {% if object.source == object.SOURCE_IMPORT %}
+ <p>Der Termin "{{ object }}" kann nicht gelöscht werden, da er importiert wurde.</p>
+ <p><a href="../../">Zurück zu den Terminen</a></p>
+ {% else %}
+ <p>{% blocktrans with object as escaped_object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktrans %}</p>
+ <ul>{{ deleted_objects|unordered_list }}</ul>
+ <form action="" method="post">{% csrf_token %}
+ <div>
+ <input type="hidden" name="post" value="yes" />
+ <input type="submit" value="{% trans "Yes, I'm sure" %}" />
+ </div>
+ </form>
+ {% endif %}
+{% endif %}
+{% endblock %}