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
eb31f1b0
Commit
eb31f1b0
authored
Sep 24, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70 from techniq/master
Use url/endpoint from passed in index_view if present
parents
72a773f5
f73d15b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
17 deletions
+15
-17
base.py
flask_admin/base.py
+6
-17
test_base.py
flask_admin/tests/test_base.py
+9
-0
No files found.
flask_admin/base.py
View file @
eb31f1b0
...
...
@@ -239,13 +239,10 @@ class AdminIndexView(BaseView):
* Automatically associates with static folder.
"""
def
__init__
(
self
,
name
=
None
,
category
=
None
,
endpoint
=
None
,
url
=
None
):
if
url
is
None
:
url
=
'/admin'
super
(
AdminIndexView
,
self
)
.
__init__
(
name
or
babel
.
lazy_gettext
(
'Home'
),
category
,
endpoint
or
'admin'
,
url
,
url
or
'/admin'
,
'static'
)
@
expose
()
...
...
@@ -342,12 +339,13 @@ class Admin(object):
name
=
'Admin'
self
.
name
=
name
if
url
is
None
:
url
=
'/admin'
self
.
url
=
url
self
.
index_view
=
index_view
or
AdminIndexView
(
endpoint
=
endpoint
,
url
=
url
)
self
.
endpoint
=
endpoint
or
self
.
index_view
.
endpoint
self
.
url
=
url
or
self
.
index_view
.
url
self
.
subdomain
=
subdomain
self
.
endpoint
=
endpoint
# Add predefined index view
self
.
add_view
(
self
.
index_view
)
# Localizations
self
.
locale_selector_func
=
None
...
...
@@ -356,15 +354,6 @@ class Admin(object):
if
app
:
self
.
_init_extension
()
# Index view
if
index_view
is
None
:
index_view
=
AdminIndexView
(
endpoint
=
self
.
endpoint
,
url
=
self
.
url
)
self
.
index_view
=
index_view
# Add predefined index view
self
.
add_view
(
index_view
)
def
add_view
(
self
,
view
):
"""
Add view to the collection.
...
...
flask_admin/tests/test_base.py
View file @
eb31f1b0
...
...
@@ -196,6 +196,15 @@ def test_delayed_init():
eq_
(
rv
.
data
,
'Success!'
)
def
test_multi_instances_init
():
app
=
Flask
(
__name__
)
admin
=
base
.
Admin
(
app
)
class
ManageIndex
(
base
.
AdminIndexView
):
pass
manage
=
base
.
Admin
(
app
,
index_view
=
ManageIndex
(
url
=
'/manage'
,
endpoint
=
'manage'
))
@
raises
(
Exception
)
def
test_double_init
():
app
=
Flask
(
__name__
)
...
...
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