Commit 0050893d authored by Priit Laes's avatar Priit Laes

Fix formatting and improve wording for `Admin.Base` API docs

parent 3c748596
......@@ -195,9 +195,9 @@ class BaseView(object):
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):
@expose('/')
......@@ -206,11 +206,12 @@ class AdminIndexView(BaseView):
admin = Admin(index_view=MyHomeView)
By default, has following rules:
1. If name is not provided, will use 'Home'
2. If endpoint is not provided, will use 'admin'
3. If url is not provided, will use '/admin'
4. Automatically associates with static folder.
Default values for the index page are following:
* If name is not provided, 'Home' will be used.
* If endpoint is not provided, will use ``admin``
* Default URL route is ``/admin``.
* Automatically associates with static folder.
"""
def __init__(self, name=None, category=None, endpoint=None, url=None):
super(AdminIndexView, self).__init__(name or babel.lazy_gettext('Home'),
......@@ -339,25 +340,25 @@ class Admin(object):
def locale_selector(self, f):
"""
Install locale selector for current admin instance.
Installs locale selector for current ``Admin`` instance.
Example::
admin = Admin(app)
@admin.locale_selector
def admin_locale_selector():
return request.args.get('lang', 'en')
Another example:
admin = Admin(app)
admin.locale_selector(admin_locale_selector)
def admin_locale_selector():
return request.args.get('lang', 'en')
It is also possible to use the ``@admin`` decorator::
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):
def locale_selector(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment