Open allphfa opened 6 years ago
from flask import Flask
from flask_admin import Admin, BaseView, expose
from flask_admin.contrib.mongoengine import ModelView
from flask_admin.menu import MenuCategory
app = Flask(__name__)
app.config['SECRET_KEY'] = 'your_secret_key'
# Define your models (User and Role) here using MongoEngine
# Custom Menu Categories
info_category = MenuCategory('Info', icon_type='glyph', icon_value='icon-desktop')
# Custom Views
class UserA(BaseView):
@expose('/')
def index(self):
# Your view logic here
return self.render('user_a.html')
# Setup Flask-Admin
admin = Admin(app, name='Admin Panel', template_mode='bootstrap3')
# Add views to Flask-Admin
admin.add_view(UserA(name='User A', category=info_category, menu_icon_type='glyph', menu_icon_value='icon-desktop'))
admin.add_view(ModelView(Role, category=info_category, menu_icon_type='glyph', menu_icon_value='icon-desktop'))
if __name__ == '__main__':
app.run(debug=True)
Can't we use it? We need to patch it.
base.html line: 6
layout.html line: 29
This is a complete theme.