Failing to overwrite admin templates

Hi,

I want to modify the template “delete_confirmation.html” in the admin view. The general approach is described in the documentation. However, I did not succeed to follow the steps.

I tried to create an example project (testadmintemplates) with an app (testapp) and add the following template:

{% extends "admin/delete_confirmation.html" %}

{% block delete_confirm %}
  <p>{% blocktranslate with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktranslate %}</p>
  {% include "admin/includes/object_delete_summary.html" %}
  <h1>asdfasdfasdfasdf</h1>
  <h2>{% translate "Objects" %}</h2>
  <form method="post">{% csrf_token %}
  <div>
  <input type="hidden" name="post" value="yes">
  {% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
  {% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
  <input type="submit" value="{% translate 'Yes, I’m sure' %}">
  <a href="#" class="button cancel-link">{% translate "No, take me back" %}</a>
  </div>
  </form>
  <ul id="deleted-objects">{{ deleted_objects|unordered_list }}</ul>
{% endblock %}

I tried a number of different places for the template but none of them worked:

  • ./testadmintemplates/templates/admin/delete_confirmation.html
  • ./testapp/templates/admin/delete_confirmation.html
  • ./templates/admin/delete_confirmation.html
  • ./templates/admin/testapp/delete_confirmation.html
  • ./templates/admin/testapp/testmodel/delete_confirmation.html
  • ./templates/testapp/admin/delete_confirmation.html
  • ./templates/testadmintemplates/admin/delete_confirmation.html

Here are the changes I did to the code apart from adding the templates

--- a/testadmintemplates/settings.py
+++ b/testadmintemplates/settings.py
@@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
 # Application definition
 
 INSTALLED_APPS = [
+    'testapp',
     'django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
@@ -54,7 +55,7 @@ ROOT_URLCONF = 'testadmintemplates.urls'
 TEMPLATES = [
     {
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
-        'DIRS': [],
+        'DIRS': [BASE_DIR/'templates'],
         'APP_DIRS': True,
         'OPTIONS': {
             'context_processors': [
--- a/testapp/admin.py
+++ b/testapp/admin.py
@@ -1,3 +1,8 @@
 from django.contrib import admin
 
 # Register your models here.
+
+from django.contrib import admin
+from .models import TestModel
+
+admin.site.register(TestModel)
--- a/testapp/models.py
+++ b/testapp/models.py
@@ -1,3 +1,6 @@
 from django.db import models
 
 # Create your models here.
+
+class TestModel(models.Model):
+    x = models.CharField(max_length=199)

Can anyone help?