How to customize Flask template templates?

I am trying to use RTL in an admin template, I know that I can override existing templates, but how to change only CSS? Any ideas?

+6
source share
1 answer

Put your CSS changes in a new CSS file in /static/css/my_flask_admin.css

Then rewrite the HTML template and include the following block:

 {% block head_css %} {{ super() }} <link rel="stylesheet" href="{{ url_for('static', filename='css/my_flask_admin.css', _external=True) }}" ></link> {% endblock %} 

The super() call loads the css source files, and the url_for(... call adds your css file afterwards and therefore applies your changes to the css source files.

+14
source

All Articles