1👍
How is your template/
directory structure set up? If an index.html
template extends from base.html
, Django will choose whatever base.html
is in your root template directory.
Solution:
Either rename one of your base.html
templates to something like base2.html
and put it in templates/
alongside base1.html
, or create new directories in templates/
to put the base.html
files into.
For solution A, make sure you change {% extends base.html %}
to {% extends base2.html %}
in the appropriate index.html
template.
For solution B, your base.html
files would keep the same name, but be in different directories. So one is in say templates/base1/base.html
and the other is in templates/base2/base.html
. Your index.html
files would extend like {% extends base1/base.html %}
and {% extends base2/base.html %}
. Note that all extension paths are relative to the root of your chosen template directory.
IMO solution B is better as it separates the code for each template base into different, explicitly named folders. Better organization/flexibility and less confusion for you in the future.