Override a template of a Django package
Question:
How can I override a change_list.html template of a Django package e.g Django import export, in an existing Django app.
E.g I want to override this package template, this is what I did in my project.
path to the file of my app : app/templates/import_export/change_list.html
Below is how am overriding :
{% extends 'import_export/change_list_export.html' %}
{% block object-tools-items %}
<div>
Hello there
</div>
{% endblock %}
I get this error :
Answers:
path to the file of your app : app/templates/import_export/change_list.html
this is the path to normal view. Not admin view.
path in git repository: app/templates/admin/import_export/change_list.html
this is the path to admin view.
I understand – you use django.admin. In this case you should add admin
folder in templates
folder.
How can I override a change_list.html template of a Django package e.g Django import export, in an existing Django app.
E.g I want to override this package template, this is what I did in my project.
path to the file of my app : app/templates/import_export/change_list.html
Below is how am overriding :
{% extends 'import_export/change_list_export.html' %}
{% block object-tools-items %}
<div>
Hello there
</div>
{% endblock %}
I get this error :
path to the file of your app : app/templates/import_export/change_list.html
this is the path to normal view. Not admin view.
path in git repository: app/templates/admin/import_export/change_list.html
this is the path to admin view.
I understand – you use django.admin. In this case you should add admin
folder in templates
folder.