I'm trying to override change_list_results.html
only for a particular model. I tried copying the file as with the other templates in the corresponding tree directory ( templates/admin/APP/MODEL
), but this method didn't work. I see in the documentation that overriding per app/model is possible, but it is not described the special method to achieve this. I found some related answer about overriding change_list.html, but I want to override only change_list_results.html and I can't understand how to accomplish just that. What is the way to do this override?
Asked
Active
Viewed 2,685 times
6

Community
- 1
- 1

symbiotech
- 1,277
- 2
- 17
- 29
2 Answers
8
I was having the same issue and found this old post. I imagine you fixed yours.
Anyways, what I was doing wrong was to use the plural name of the model and I was also using the lowercase name. You have to be sure of the following:
- Save your template in /templates/admin/APP/MODEL as you said
- Check your lower/upper cases in the names of the models
- This sounds silly, but just in case...Don't use the plural name of the model
Good luck!

freethinker6
- 301
- 3
- 12
-
Had the same problem, I had a model whose name was made of two words (FooMoo). In the admin interface it is rewritten as 'foo_moo', but to override the template you need to create a directory called 'foomoo' – Kaël Aug 31 '16 at 13:42
2
This may have changed since freethinker6's answer: change_list_results.html is currently hardcoded.

Nathan Reynolds
- 21
- 1
-
"For each app in INSTALLED_APPS, the app_directories.Loader looks for a templates subdirectory. If the directory exists, Django looks for templates in there." (https://docs.djangoproject.com/en/1.11/ref/templates/api/#django.template.loaders.app_directories.Loader) – Soitje Jul 04 '17 at 17:14
-
You can override this template with your own file. However, this override will apply to all models within the admin, and the question asks how to override it for a single model. – Nathan Reynolds Jul 05 '17 at 08:03
-
The method posted by freethinker6 and Kaël below works, at least for Django 3.2.4 which I am using. – Hiep Ho Feb 05 '22 at 03:13