Open servitor-io opened 5 years ago
hi,
I've the same behavour when I try to create a custom view extending admin/master.html. All of the code inserted for the navigation (into ul tag with 'class="nav navbar-nav"' in div tag id="admin-navbar-collapse") appear as a string in my browser (Google Chrome Version 80.0.3987.149 (Build officiel) (64 bits) Window 10 Pro). I've tryed to change the reference of the template extended, but no change see at all.
I use the 1.5.5 version of Flask-Admin with bootstrap3 template mode.
I tried 2 simple modifications in admin / base.html: add '| secure 'to the execution order of the macros layout.menu () and layout.menu_link () then the navigation menu appears as expected.
Can we quickly integrate this modification in order to control its effectiveness and if it does not generate any disorder effect in the rendering of pages (system or user)?
Appreciate this has been a while, but may be helpful for those searching for this problem. I had a similar issue although it was only the top navbar links that were escaped out and displaying incorrectly for me.
I was able to resolve by changing my custom template extension from .html.j2
to .html
. I noticed your custom template also had the double extension .html.jinja
. Not sure why the admin templating system is being picky about the file extension?
@TomHall2020 I did have the exact same problem. Maybe we should rename the issue or open a new one about not accepting other file extension or maybe adding jinja
, jinja2
, j2
, etc.
Just had the same issue here using templates ending with .html.jinja
.
Supplying a custom template like:
and then passing these templates in the ModelView subclass like:
The HTML doesn't get properly rendered, the resulting source looks like:
And the appearance is like:
I'm just following the example from the documentation here: https://flask-admin.readthedocs.io/en/latest/introduction/#extending-the-built-in-templates
Is there something missing to make this template customization work? When I don't try to override defaults everything appears to work correctly