Commit 208adeab authored by Christopher Toth's avatar Christopher Toth

Minor English cleanup for flask_admin.base

parent 9f378fae
...@@ -107,7 +107,7 @@ class BaseView(object): ...@@ -107,7 +107,7 @@ class BaseView(object):
arguments you want to pass to the template and call parent view. arguments you want to pass to the template and call parent view.
These arguments are local for this request and will be discarded These arguments are local for this request and will be discarded
in next request. in the next request.
Any value passed through ``_template_args`` will override whatever Any value passed through ``_template_args`` will override whatever
parent view function passed to the template. parent view function passed to the template.
...@@ -133,17 +133,17 @@ class BaseView(object): ...@@ -133,17 +133,17 @@ class BaseView(object):
Constructor. Constructor.
:param name: :param name:
Name of this view. If not provided, will be defaulted to the class name. Name of this view. If not provided, will default to the class name.
:param category: :param category:
View category. If not provided, will be shown as a top-level menu item. Otherwise, will View category. If not provided, this view will be shown as a top-level menu item. Otherwise, it will
be in a submenu. be in a submenu.
:param endpoint: :param endpoint:
Base endpoint name for the view. For example, if there's view method called "index" and Base endpoint name for the view. For example, if there's a view method called "index" and
endpoint was set to "myadmin", you can use `url_for('myadmin.index')` to get URL to the endpoint is set to "myadmin", you can use `url_for('myadmin.index')` to get the URL to the
view method. By default, equals to the class name in lower case. view method. Defaults to the class name in lower case.
:param url: :param url:
Base URL. If provided, affects how URLs are generated. For example, if url parameter Base URL. If provided, affects how URLs are generated. For example, if the url parameter
equals to "test", resulting URL will look like "/admin/test/". If not provided, will is "test", the resulting URL will look like "/admin/test/". If not provided, will
use endpoint as a base url. However, if URL starts with '/', absolute path is assumed use endpoint as a base url. However, if URL starts with '/', absolute path is assumed
and '/admin/' prefix won't be applied. and '/admin/' prefix won't be applied.
""" """
...@@ -230,7 +230,7 @@ class BaseView(object): ...@@ -230,7 +230,7 @@ class BaseView(object):
def _prettify_name(self, name): def _prettify_name(self, name):
""" """
Prettify class name by splitting name by capital characters. So, 'MySuperClass' will look like 'My Super Class' Prettify a class name by splitting the name on capitalized characters. So, 'MySuperClass' becomes 'My Super Class'
:param name: :param name:
String to prettify String to prettify
...@@ -241,10 +241,10 @@ class BaseView(object): ...@@ -241,10 +241,10 @@ class BaseView(object):
""" """
Override this method to add permission checks. Override this method to add permission checks.
Flask-Admin does not make any assumptions about authentication system used in your application, so it is Flask-Admin does not make any assumptions about the authentication system used in your application, so it is
up for you to implement it. up to you to implement it.
By default, it will allow access for the everyone. By default, it will allow access for everyone.
""" """
return True return True
...@@ -252,7 +252,7 @@ class BaseView(object): ...@@ -252,7 +252,7 @@ class BaseView(object):
""" """
This method will be executed before calling any view method. This method will be executed before calling any view method.
By default, it will check if admin class is accessible and if it is not - will By default, it will check if the admin class is accessible and if it is not it will
throw HTTP 404 error. throw HTTP 404 error.
:param name: :param name:
...@@ -278,10 +278,10 @@ class AdminIndexView(BaseView): ...@@ -278,10 +278,10 @@ class AdminIndexView(BaseView):
admin = Admin(index_view=MyHomeView()) admin = Admin(index_view=MyHomeView())
Default values for the index page are following: Default values for the index page are:
* If name is not provided, 'Home' will be used. * If a name is not provided, 'Home' will be used.
* If endpoint is not provided, will use ``admin`` * If an endpoint is not provided, will default to ``admin``
* Default URL route is ``/admin``. * Default URL route is ``/admin``.
* Automatically associates with static folder. * Automatically associates with static folder.
* Default template is ``admin/index.html`` * Default template is ``admin/index.html``
...@@ -351,7 +351,7 @@ class MenuItem(object): ...@@ -351,7 +351,7 @@ class MenuItem(object):
class Admin(object): class Admin(object):
""" """
Collection of the views. Also manages menu structure. Collection of the admin views. Also manages menu structure.
""" """
def __init__(self, app=None, name=None, def __init__(self, app=None, name=None,
url=None, subdomain=None, url=None, subdomain=None,
...@@ -364,19 +364,19 @@ class Admin(object): ...@@ -364,19 +364,19 @@ class Admin(object):
:param app: :param app:
Flask application object Flask application object
:param name: :param name:
Application name. Will be displayed in main menu and as a page title. If not provided, defaulted to "Admin" Application name. Will be displayed in the main menu and as a page title. Defaults to "Admin"
:param url: :param url:
Base URL Base URL
:param subdomain: :param subdomain:
Subdomain to use Subdomain to use
:param index_view: :param index_view:
Home page view to use. If not provided, will use `AdminIndexView`. Home page view to use. Defaults to `AdminIndexView`.
:param translations_path: :param translations_path:
Location of the translation message catalogs. By default will use translations Location of the translation message catalogs. By default will use the translations
shipped with the Flask-Admin. shipped with Flask-Admin.
:param endpoint: :param endpoint:
Base endpoint name for index view. If you use multiple instances of `Admin` class with Base endpoint name for index view. If you use multiple instances of the `Admin` class with
one Flask application, you have to set unique endpoint name for each instance. a single Flask application, you have to set a unique endpoint name for each instance.
""" """
self.app = app self.app = app
...@@ -407,7 +407,7 @@ class Admin(object): ...@@ -407,7 +407,7 @@ class Admin(object):
def add_view(self, view): def add_view(self, view):
""" """
Add view to the collection. Add a view to the collection.
:param view: :param view:
View to add. View to add.
...@@ -422,7 +422,7 @@ class Admin(object): ...@@ -422,7 +422,7 @@ class Admin(object):
def locale_selector(self, f): def locale_selector(self, f):
""" """
Installs locale selector for current ``Admin`` instance. Installs a locale selector for the current ``Admin`` instance.
Example:: Example::
...@@ -453,7 +453,7 @@ class Admin(object): ...@@ -453,7 +453,7 @@ class Admin(object):
def _add_view_to_menu(self, view): def _add_view_to_menu(self, view):
""" """
Add view to the menu tree Add a view to the menu tree
:param view: :param view:
View to add View to add
...@@ -472,7 +472,7 @@ class Admin(object): ...@@ -472,7 +472,7 @@ class Admin(object):
def init_app(self, app): def init_app(self, app):
""" """
Register all views with Flask application. Register all views with the Flask application.
:param app: :param app:
Flask application instance Flask application instance
...@@ -506,6 +506,6 @@ class Admin(object): ...@@ -506,6 +506,6 @@ class Admin(object):
def menu(self): def menu(self):
""" """
Return menu hierarchy. Return the menu hierarchy.
""" """
return self._menu return self._menu
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