jonalxh/Flask-Admin-Dashboard

how to customize admin/index.html ?

Closed this issue · 4 comments

Hello.
Thanks for your fancy dash board .
Let me ask you one thing about front page UI.

I'd like to customize the front UI dashboard (graph, chat, todo ..etc) from admin/index.html .
Therefore I need to implement the flask code which get some values from database,
and then
render_template('admin/index.html', some_value='blah blah')

However I cannot find the way to access this template html from flask backend.

Thanks for your support in advance.

Hi @MinkyuHa

  • I've found this example where they override the AdminIndexView.

  • Have you tried the custom index? There I've written an independent html file which doesn't need flask-admin, inside the function referenced below you could make your DB queries an then pass the values you want.

    class CustomView(BaseView):
    @expose('/')
    def index(self):
    return self.render('admin/custom_index.html')

  • If this is not what you're looking for, I recommend you to give a look to flask-admin context processor in this link, at the moment I've not free time to help you with a working example, but let me know if you get it with my recommendations.

Hi @jonalxh
Thanks for your comment.
of course, I know how to add the custom view from your example.
However it's for adding the menu from left panel.

What I'm looking for is that customizing the first page which users see at first time. ==> admin/index.html .
I can see that this file is showing the graph, chart, etc.
This seems not to be customized from admin.add_view(....)

Meanwhile, I'll check the flask-admin context processor.

Thank you.

Look at the first item of my answer above, I think it will work for you.

Oh, I missed it. Thank you very much. I'll try.