[Django]-Why can't I override the Django Admin template?

2👍

base_site.html should be placed in /templates/admin folder itself as shown below:

/templates/admin/base_site.html instead of /templates/admin/my_app/base_site.html

1👍

base_site.html can be automatically overridden only in /templates/admin/ but not in /templates/admin/<app>/ and /templates/admin/<app>/<model>/.

According to my experiments and the doc, the django admin templates in django/contrib/admin/templates/admin/ in your virtual environment below can be automatically overridden all in /templates/admin/, /templates/admin/<app>/ and /templates/admin/<app>/<model>/. *app_index.html is not meaningful to override in /templates/admin/<app>/<model>/:

actions.html  
app_index.html # *Not meaningful to override in `/templates/admin/<app>/<model>/`  
change_form.html  
change_form_object_tools.html  
change_list.html  
change_list_object_tools.html  
change_list_results.html  
date_hierarchy.html  
delete_confirmation.html
delete_selected_confirmation.html
object_history.html  
pagination.html  
popup_response.html  
prepopulated_fields_js.html  
search_form.html  
submit_line.html

And according to my experiments, the django admin templates in django/contrib/admin/templates/admin/ in your virtual environment below can be automatically overridden only in /templates/admin/:

app_list.html
base.html
base_site.html
filter.html
index.html
login.html
nav_sidebar.html

And according to my experiments, the django admin templates in django/contrib/admin/templates/admin/auth/user/ in your virtual environment below can be automatically overridden only in /templates/admin/auth/user/:

add_form.html
change_password.html

And according to my experiments, the django admin templates in django/contrib/admin/templates/admin/edit_inline/ in your virtual environment below can be automatically overridden only in /templates/admin/edit_inline/:

stacked.html
tabular.html

And according to my experiments, the django admin templates in django/contrib/admin/templates/admin/includes/ in your virtual environment below can be automatically overridden only in /templates/admin/includes/:

fieldset.html
object_delete_summary.html

And according to my experiments, the django admin templates in django/contrib/admin/templates/admin/widgets/ in your virtual environment below can be manually overridden under /templates/*:

clearable_file_input.html
foreign_key_raw_id.html
many_to_many_raw_id.html
radio.html
related_widget_wrapper.html
split_datetime.html
url.html

Leave a comment