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
5bec9db7
Commit
5bec9db7
authored
Aug 25, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #39. Now it is possible to pass subdomain
parent
a850544e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
base.py
flask_admin/base.py
+22
-4
No files found.
flask_admin/base.py
View file @
5bec9db7
...
...
@@ -126,11 +126,18 @@ class BaseView(object):
# If url is not provided, generate it from endpoint name
if
self
.
url
is
None
:
self
.
url
=
'
%
s/
%
s'
%
(
self
.
admin
.
url
,
self
.
endpoint
)
if
self
.
admin
.
url
!=
'/'
:
self
.
url
=
'
%
s/
%
s'
%
(
self
.
admin
.
url
,
self
.
endpoint
)
else
:
self
.
url
=
'/'
else
:
if
not
self
.
url
.
startswith
(
'/'
):
self
.
url
=
'
%
s/
%
s'
%
(
self
.
admin
.
url
,
self
.
url
)
# If we're working from the root of the site, set prefix to None
if
self
.
url
==
'/'
:
self
.
url
=
None
# If name is not povided, use capitalized endpoint name
if
self
.
name
is
None
:
self
.
name
=
self
.
_prettify_name
(
self
.
__class__
.
__name__
)
...
...
@@ -138,6 +145,7 @@ class BaseView(object):
# Create blueprint and register rules
self
.
blueprint
=
Blueprint
(
self
.
endpoint
,
__name__
,
url_prefix
=
self
.
url
,
subdomain
=
self
.
admin
.
subdomain
,
template_folder
=
'templates'
,
static_folder
=
self
.
static_folder
)
...
...
@@ -214,13 +222,16 @@ 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
or
'/admin'
,
url
,
'static'
)
@
expose
(
'/'
)
@
expose
()
def
index
(
self
):
return
self
.
render
(
'admin/index.html'
)
...
...
@@ -277,7 +288,9 @@ class Admin(object):
"""
Collection of the views. Also manages menu structure.
"""
def
__init__
(
self
,
app
=
None
,
name
=
None
,
url
=
None
,
index_view
=
None
,
def
__init__
(
self
,
app
=
None
,
name
=
None
,
url
=
None
,
subdomain
=
None
,
index_view
=
None
,
translations_path
=
None
):
"""
Constructor.
...
...
@@ -286,6 +299,10 @@ class Admin(object):
Flask application object
`name`
Application name. Will be displayed in main menu and as a page title. If not provided, defaulted to "Admin"
`url`
Base URL
`subdomain`
Subdomain to use
`index_view`
Home page view to use. If not provided, will use `AdminIndexView`.
`translations_path`
...
...
@@ -307,6 +324,7 @@ class Admin(object):
if
url
is
None
:
url
=
'/admin'
self
.
url
=
url
self
.
subdomain
=
subdomain
# Localizations
self
.
locale_selector_func
=
None
...
...
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