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
b84302ef
Commit
b84302ef
authored
Feb 16, 2016
by
Brian Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow adding a sub-category just like you add a view
parent
c8f239e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
base.py
flask_admin/base.py
+19
-0
No files found.
flask_admin/base.py
View file @
b84302ef
...
...
@@ -557,6 +557,25 @@ class Admin(object):
for
view
in
args
:
self
.
add_view
(
view
)
def
add_sub_category
(
self
,
name
,
parent_name
):
"""
Add a category of a given name underneath
the category with parent_name.
:param name:
The name of the new menu category.
:param parent_name:
The name of a parent_name category
"""
category
=
self
.
get_category_menu_item
(
name
)
parent
=
self
.
get_category_menu_item
(
parent_name
)
if
category
is
None
and
parent
is
not
None
:
category
=
SubMenuCategory
(
name
)
self
.
_menu_categories
[
name
]
=
category
parent
.
add_child
(
category
)
def
add_link
(
self
,
link
):
"""
Add link to menu links collection.
...
...
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