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
0050893d
Commit
0050893d
authored
May 30, 2012
by
Priit Laes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting and improve wording for `Admin.Base` API docs
parent
3c748596
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
base.py
flask_admin/base.py
+17
-16
No files found.
flask_admin/base.py
View file @
0050893d
...
@@ -195,9 +195,9 @@ class BaseView(object):
...
@@ -195,9 +195,9 @@ class BaseView(object):
class
AdminIndexView
(
BaseView
):
class
AdminIndexView
(
BaseView
):
"""
"""
Administrative interface entry page. You can see it by going to the /admin/
URL.
Default administrative interface index page when visiting the ``/admin/``
URL.
You can override this page by passing your own view class to the `Admin
` constructor::
It can be overridden by passing your own view class to the ``Admin`
` constructor::
class MyHomeView(AdminIndexView):
class MyHomeView(AdminIndexView):
@expose('/')
@expose('/')
...
@@ -206,11 +206,12 @@ class AdminIndexView(BaseView):
...
@@ -206,11 +206,12 @@ class AdminIndexView(BaseView):
admin = Admin(index_view=MyHomeView)
admin = Admin(index_view=MyHomeView)
By default, has following rules:
Default values for the index page are following:
1. If name is not provided, will use 'Home'
2. If endpoint is not provided, will use 'admin'
* If name is not provided, 'Home' will be used.
3. If url is not provided, will use '/admin'
* If endpoint is not provided, will use ``admin``
4. Automatically associates with static folder.
* Default URL route is ``/admin``.
* Automatically associates with static folder.
"""
"""
def
__init__
(
self
,
name
=
None
,
category
=
None
,
endpoint
=
None
,
url
=
None
):
def
__init__
(
self
,
name
=
None
,
category
=
None
,
endpoint
=
None
,
url
=
None
):
super
(
AdminIndexView
,
self
)
.
__init__
(
name
or
babel
.
lazy_gettext
(
'Home'
),
super
(
AdminIndexView
,
self
)
.
__init__
(
name
or
babel
.
lazy_gettext
(
'Home'
),
...
@@ -339,25 +340,25 @@ class Admin(object):
...
@@ -339,25 +340,25 @@ class Admin(object):
def
locale_selector
(
self
,
f
):
def
locale_selector
(
self
,
f
):
"""
"""
Install
locale selector for current admin
instance.
Install
s locale selector for current ``Admin``
instance.
Example::
Example::
admin = Admin(app)
@admin.locale_selector
def admin_locale_selector():
def admin_locale_selector():
return request.args.get('lang', 'en')
return request.args.get('lang', 'en')
Another example:
admin = Admin(app)
admin.locale_selector(admin_locale_selector)
def admin_locale_selector():
It is also possible to use the ``@admin`` decorator::
return request.args.get('lang', 'en')
admin = Admin(app)
admin = Admin(app)
admin.locale_selector(admin_locale_selector)
And if you want to subclass ``Admin``, you can do something like:
@admin.locale_selector
def admin_locale_selector():
return request.args.get('lang', 'en')
Or by subclassing the ``Admin``::
class MyAdmin(Admin):
class MyAdmin(Admin):
def locale_selector(self):
def locale_selector(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