Skip to content

Commit

Permalink
fixed admin duplicate views bug
Browse files Browse the repository at this point in the history
  • Loading branch information
seagullbird committed Sep 4, 2017
1 parent e02f3d0 commit eb2ba76
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/__init__.py
Expand Up @@ -13,7 +13,6 @@
mail = Mail()
db = SQLAlchemy()
login_manager = LoginManager()
admin = Admin(name='BLEXT Backstage')

# 设置安全等级为 strong ,
# Flask-Login会记录客户端IP地址和浏览器的用户代理信息,如果发现异动就登出用户
Expand All @@ -37,7 +36,7 @@ def create_app(config_name):
# 添加 Model View
from .models import User, Blog, Category, Tag
from .ModelView import BLEXTAdminIndexView, UserModelView, BlogModelView, CateModelView, TagModelView
admin.init_app(app, index_view=BLEXTAdminIndexView())
admin = Admin(app=app, name='BLEXT Backstage', index_view=BLEXTAdminIndexView())
admin.add_view(UserModelView(User, db.session, endpoint='user-admin'))
admin.add_view(BlogModelView(Blog, db.session, endpoint='blog-admin'))
admin.add_view(CateModelView(Category, db.session, endpoint='cate-admin'))
Expand Down

0 comments on commit eb2ba76

Please sign in to comment.