0

I use flask-appbuilder, I use ModelView Like:

class ListView(ModelView):
    datamodel = SQLAInterface(mylist)
    edit_form = listEditForm

     list_title = "List"
     list_columns = ["listid",'listtype','listowner', 'creationtime', 'creationempid','changetime', 'changeempid']
     related_views = [ListNumberView]

I want to build a form action on ListNumberView which do not need to select item.

I mean I want to add a button on list page of ListNumberView which can linked to other page with, do not need to select any items.

How to do it.

user504909
  • 9,119
  • 12
  • 60
  • 109

1 Answers1

0

You can create a widget and save it under /templates/widgets/base_list.html. Add the following content.

{% extends 'appbuilder/general/widgets/base_list.html' %}

{% block list_header %}
   {{ super() }}
   <a href={{url_for('NameModelView' + '.download_csv', **request.args)}} class="btn btn-sm btn-primary"
        <i class="fa fa-rocket"></i>
   </a>
{% endblock %}

The button will be rendered on the list header next to pagination, add and download buttons.

Lenin
  • 303
  • 2
  • 3