diff options
author | Markus Zapke-Gründemann <info@keimlink.de> | 2012-01-05 22:40:29 +0100 |
---|---|---|
committer | Markus Zapke-Gründemann <info@keimlink.de> | 2012-01-05 22:40:29 +0100 |
commit | 48454beba7998cfd90d7d2b6aa085d1160032db1 (patch) | |
tree | 823089bc631b87341302dc9440b4958eac306103 /sublab_project/calendarium | |
parent | d33479d440967651640008aaa386adb83603e235 (diff) |
Disabled deletion of imported events.
Diffstat (limited to 'sublab_project/calendarium')
-rw-r--r-- | sublab_project/calendarium/admin.py | 2 | ||||
-rw-r--r-- | sublab_project/calendarium/templates/calendarium/delete_confirmation.html | 47 |
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> › + <a href="../../../">{{ app_label|capfirst }}</a> › + <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> › + <a href="../">{{ object|truncatewords:"18" }}</a> › + {% 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 %} |