Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
9361fd15
Commit
9361fd15
authored
Mar 22, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with menu initialization.
parent
44334984
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
simple.py
examples/simple/simple.py
+2
-1
base.py
flask_adminex/base.py
+9
-6
No files found.
examples/simple/simple.py
View file @
9361fd15
...
...
@@ -31,9 +31,10 @@ def index():
if
__name__
==
'__main__'
:
# Create admin interface
admin
=
adminex
.
Admin
(
app
)
admin
=
adminex
.
Admin
()
admin
.
add_view
(
MyAdminView
(
category
=
'Test'
))
admin
.
add_view
(
AnotherAdminView
(
category
=
'Test'
))
admin
.
init_app
(
app
)
# Start app
app
.
debug
=
True
...
...
flask_adminex/base.py
View file @
9361fd15
...
...
@@ -305,6 +305,12 @@ class Admin(object):
# Add to views
self
.
_views
.
append
(
view
)
# If app was provided in constructor, register view with Flask app
if
self
.
app
is
not
None
:
self
.
app
.
register_blueprint
(
view
.
create_blueprint
(
self
))
self
.
_add_view_to_menu
(
view
)
def
_add_view_to_menu
(
self
,
view
):
# Update menu
if
view
.
category
:
category
=
self
.
_menu_categories
.
get
(
view
.
category
)
...
...
@@ -318,10 +324,6 @@ class Admin(object):
else
:
self
.
_menu
.
append
(
MenuItem
(
view
.
name
,
view
))
# If app was provided in constructor, register view with Flask app
if
self
.
app
is
not
None
:
self
.
app
.
register_blueprint
(
view
.
create_blueprint
(
self
))
def
init_app
(
self
,
app
):
"""
Register all views with Flask application.
...
...
@@ -334,8 +336,9 @@ class Admin(object):
self
.
app
=
app
for
v
in
self
.
_views
:
app
.
register_blueprint
(
v
.
create_blueprint
(
self
))
for
view
in
self
.
_views
:
app
.
register_blueprint
(
view
.
create_blueprint
(
self
))
self
.
_add_view_to_menu
(
view
)
def
menu
(
self
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment