pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
https://flask-admin.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5.69k stars 1.56k forks source link

Add Button in Flask admin page #2378

Closed ahmedzzabdalla0 closed 12 hours ago

ahmedzzabdalla0 commented 10 months ago

How can I add button behind create button

Here image

Zasgard commented 8 months ago

It sounds like you may not fully understand the jinja templating system used in Flask Admin. I recommend that you take a closer look at that material. To give you a place to start, Flask Admin utilizes blocks of html that can be overwritten in different areas to customize different parts of the pages. In your case here, you would probably want to overwrite or add to the block model_menu_bar_before_filters. So in your main list.html (assuming you're using that), you could for example have:

{% block model_menu_bar_before_filters %}
      <li>
        <a class="nav-link" href="{{ url_for('.example_url', **request.args) }}">{{ _gettext('Example Button) }}</a>
      </li>
{% endblock %}

You will need the corresponding route on the python side but what this does is attaches the example_url route to an Example Button that then exists in the space before the filters in the menu bar. Hope this helps gets you started!