Commit 4190e319 authored by Petrus J.v.Rensburg's avatar Petrus J.v.Rensburg

Fix heading format and use consistent capitalization throughout.

parent 0cc13aba
.. _adding-model-backend:
Adding a Model Backend
==========================
Adding A Model Backend
======================
Flask-Admin makes a few assumptions about the database models that it works with. If you want to implement your own
database backend, and still have Flask-Admin's model views work as expected, then you should take note of the following:
......@@ -14,7 +14,7 @@ If that is the case, then you can implement your own database backend by extendi
and implementing the set of scaffolding methods listed below.
Extending BaseModelView
-------------------------
-----------------------
Start off by defining a new class, which derives from from :class:`~flask_admin.model.BaseModelView`::
......
:tocdepth: 2
Advanced Functionality
=================================
======================
Localization With Flask-Babelex
------------------------------------------
-------------------------------
****
......@@ -45,7 +45,7 @@ to see how you can add your own.
.. _file-admin:
Managing Files & Folders
--------------------------------
------------------------
****
......@@ -67,8 +67,8 @@ can use it by adding a FileAdmin view to your app::
You can disable uploads, disable file deletion, restrict file uploads to certain types, etc.
Check :mod:`flask_admin.contrib.fileadmin` in the API documentation for more details.
Adding a Redis Console
--------------------------
Adding A Redis Console
----------------------
****
......@@ -87,7 +87,7 @@ instance running on the same machine as your app, you can::
Replacing Individual Form Fields
------------------------------------------
--------------------------------
****
......@@ -96,7 +96,7 @@ A common use-case for this would be to add a *What-You-See-Is-What-You-Get* (WYS
file / image uploads that need to be tied to a field in your model.
WYSIWIG Text Fields
**********************
*******************
To handle complicated text content, you can use
`CKEditor <http://ckeditor.com/>`_ by subclassing some of the builtin WTForms
classes as follows::
......@@ -152,7 +152,7 @@ If you just want to manage static files in a directory, without tying them to a
rather use the handy :ref:`File-Admin<file-admin>` plugin.
Managing Geographical Models
-------------------------------------------
----------------------------
****
......@@ -194,7 +194,7 @@ Have a look at https://github.com/flask-admin/flask-admin/tree/master/examples/g
to get started.
Loading Tiles From Mapbox
**************************************
*************************
To have map data display correctly, you'll have to sign up for an account at https://www.mapbox.com/
and include some credentials in your application's config::
......@@ -209,14 +209,14 @@ at the moment, Flask-Admin only supports Mapbox. If you want to use other
providers, make a pull request!
Limitations
*******************
***********
There's currently no way to sort, filter, or search on geometric fields
in the admin. It's not clear that there's a good way to do so.
If you have any ideas or suggestions, make a pull request!
Customising Builtin Forms via Rendering Rules
--------------------------------------------------------
Customising Builtin Forms Via Rendering Rules
---------------------------------------------
****
......@@ -253,8 +253,8 @@ using the :class:`flask_admin.form.rules.Text` class::
class RuleView(sqla.ModelView):
form_create_rules = ('email', rules.Text('Foobar'), 'first_name', 'last_name')
Built-in rules
*******************
Built-in Rules
**************
Flask-Admin comes with few built-in rules that can be found in the :mod:`flask_admin.form.rules` module:
......@@ -275,7 +275,7 @@ Form Rendering Rule Description
.. _database-backends:
Using Different Database Backends
----------------------------------------
---------------------------------
****
......@@ -290,7 +290,7 @@ relations between your data models. If you want to track spatial data like latit
points, you should look into `GeoAlchemy`_, as well.
SQLAlchemy
********************
**********
Notable features:
......@@ -338,7 +338,7 @@ a proper error message and you can change the data in the form. When the applica
the ``werkzeug`` debugger will catch the exception and will display the stacktrace.
MongoEngine
*********************
***********
If you're looking for something simpler than SQLAlchemy, and your data models
are reasonably self-contained, then `MongoDB <https://www.mongodb.org/>`_, a popular *NoSQL* database,
......@@ -368,7 +368,7 @@ Known issues:
For more, check the :class:`~flask_admin.contrib.mongoengine` API documentation.
Peewee
*****************
******
Features:
......@@ -387,7 +387,7 @@ For more, check the :class:`~flask_admin.contrib.peewee` API documentation. Or l
the Peewee example at https://github.com/flask-admin/flask-admin/tree/master/examples/peewee.
PyMongo
*****************
*******
The bare minimum you have to provide for Flask-Admin to work with PyMongo:
......@@ -417,7 +417,7 @@ For more, check the :class:`~flask_admin.contrib.pymongoe` API documentation. Or
the Peewee example at https://github.com/flask-admin/flask-admin/tree/master/examples/pymongo.
Migrating From Django
-------------------------
---------------------
****
......@@ -425,7 +425,7 @@ If you are used to `Django <https://www.djangoproject.com/>`_ and the *django-ad
Flask-Admin to work slightly different from what you would expect.
Design Philosophy
****************************
*****************
In general, Django and *django-admin* strives to make life easier by implementing sensible defaults. So a developer
will be able to get an application up in no time, but it will have to conform to most of the defaults. Of course it
......@@ -473,8 +473,8 @@ backends) and specific backend documentation, for example
:class:`~flask_admin.contrib.sqla.ModelView`. There's much more
than what is displayed in this table.
Overriding the Form Scaffolding
---------------------------------
Overriding The Form Scaffolding
-------------------------------
****
......
:tocdepth: 2
Flask-Admin
##########################################
###########
**Why Flask?** As a micro-framework, `Flask <http://flask.pocoo.org/>`_ lets you build web services with very little overhead.
It offers freedom for you, the designer, to implement your project in a way that suits your
......@@ -37,13 +37,13 @@ directory in the `GitHub repository <https://github.com/flask-admin/flask-admin>
changelog
Support
----------
-------
****
Python 2.6 - 2.7 and 3.3 - 3.4.
Indices and tables
Indices And Tables
------------------
****
......
:tocdepth: 2
Introduction to Flask-Admin
##########################################
Introduction To Flask-Admin
###########################
Getting Started
================
===============
****
Initialization
-------------------
--------------
The first step, is to initialise an empty admin interface on your Flask app::
......@@ -30,7 +30,7 @@ If you start this application and navigate to `http://localhost:5000/admin/ <htt
you should see an empty page with a navigation bar on top.
Adding Model Views
----------------------
------------------
Model views allow you to add a dedicated set of admin pages for managing any model in your database. Do this by creating
instances of the *ModelView* class, which you can import from one of Flask-Admin's built-in ORM backends. An example
......@@ -55,7 +55,7 @@ For more details on that, see :ref:`customising-builtin-views`. For more details
ORM backends that are available, see :ref:`database-backends`.
Enabling CSRF Validation
-----------------------------
------------------------
To add CSRF protection to the forms that are generated by *ModelView* instances, use the
`FlaskWTF <https://flask-wtf.readthedocs.org/>`_ form class in your *ModelView*
......@@ -76,7 +76,7 @@ The FlaskWTF form class comes with CSRF protection builtin, so it will generate
the tokens for you, and validate them when the forms are submitted.
Adding Content to the Index Page
------------------------------------
--------------------------------
The first thing you'll notice when you visit `http://localhost:5000/admin/ <http://localhost:5000/admin/>`_
is that it's just an empty page with a navigation menu. To add some content to this page, save the following text as `admin/index.html` in your project's `templates` directory::
......@@ -90,7 +90,7 @@ This will override the default index template, but still give you the builtin na
So, now you can add any content to the index page, while maintaining a consistent user experience.
Authorisation & Permissions
=================================
===========================
****
......@@ -99,7 +99,7 @@ you'll want to solve is how to keep unwanted users out. With Flask-Admin there
are a few different ways of approaching this.
HTTP Basic Auth
------------------------
---------------
The simplest form of authentication is HTTP Basic Auth. It doesn't interfere
with your database models, and it doesn't require you to write any new view logic or
template code. So it's great for when you're deploying something that's still
......@@ -112,7 +112,7 @@ Unfortunately, there is no easy way of applying HTTP Basic Auth just to your adm
interface.
Rolling Your Own
--------------------------------
----------------
For a more flexible solution, Flask-Admin lets you define access control rules
on each of your admin view classes by simply overriding the `is_accessible` method.
How you implement the logic is up to you, but if you were to use a low-level library like
......@@ -138,7 +138,7 @@ registration and account management views yourself.
Using Flask-Security
--------------------------------
--------------------
If you want a more polished solution, you could
use `Flask-Security <https://pythonhosted.org/Flask-Security/>`_,
......@@ -173,7 +173,7 @@ approach for including the other views, like `forgot_password`, `send_confirmati
.. _customising-builtin-views:
Customising Builtin Views
=================================
=========================
****
......@@ -209,7 +209,7 @@ Or, in much the same way, you can specify options for a single model at a time::
`ModelView` Configuration Attributes
-------------------------------------
------------------------------------
For a complete list of the attributes that are defined, have a look at the
API documentation for :meth:`~flask_admin.model.BaseModelView`. Here follows
......@@ -293,7 +293,7 @@ These inline forms can be customised. Have a look at the API documentation for
:meth:`~flask_admin.contrib.sqla.ModelView.inline_models`.
Adding Your Own Views
======================
=====================
****
......@@ -302,7 +302,7 @@ them with the builtin :class:`~flask_admin.model.ModelView` class, Flask-Admin m
take full control and add your own views to the interface.
Standalone Views
------------------
----------------
A set of standalone views, that are not tied to any particular model, can be added by extending the
:class:`~flask_admin.base.BaseView` class, and defining your own view methods on it. For
example, to add a page that displays some analytics data from a 3rd-party API::
......@@ -331,8 +331,8 @@ The `analytics_index.html` template for the example above, could look something
By extending the *admin/master.html* template, you can maintain a consistent user experience,
even while having tight control over your page's content.
Overriding the Builtin Views
------------------------------------
Overriding The Builtin Views
----------------------------
There may be some scenarios where you want most of the builtin ModelView
functionality, but you want to replace one of the default `create`, `edit`, or `list` views.
For this you could override only the view in question, and all the links to it will still function as you would expect::
......@@ -350,15 +350,15 @@ For this you could override only the view in question, and all the links to it w
return self.render('create_user.html')
Working with the builtin templates
====================================
Working With The Builtin Templates
==================================
****
Flask-Admin uses the `Jinja2 <http://jinja.pocoo.org/docs/>`_ templating engine.
Overriding the Builtin Templates
---------------------------------
Overriding The Builtin Templates
--------------------------------
To take full control over the style and layout of the admin interface, you can override
all of the builtin templates. Just keep in mind that the templates will change slightly
......@@ -372,8 +372,8 @@ automatically take precedence over the builtin ones.
.. _extending-builtin-templates:
Extending the Builtin Templates
---------------------------------
Extending The Builtin Templates
-------------------------------
Rather than overriding the builtin templates completely, you could extend them. This
could make it simpler for you to upgrade to new Flask Admin versions in future.
......@@ -408,7 +408,7 @@ the admin constructor during initialization::
admin = Admin(app, base_template='microblog_master.html')
Available Template Blocks
****************************
*************************
Flask-Admin defines one *base* template at `admin/master.html` that all the other admin templates are derived
from. This template is a proxy which points to `admin/base.html`, which defines
......@@ -449,7 +449,7 @@ empty_list_message Message that will be displayed if there are no models fo
Have a look at the `layout` example at https://github.com/flask-admin/flask-admin/tree/master/examples/layout
to see how you can take full stylistic control over the admin interface.
Environment variables
Environment Variables
---------------------
While working in any of the templates that extend `admin/master.html`, you have access to a small number of
......@@ -466,7 +466,7 @@ h Helpers from :mod:`~flask_admin.helpers` module
==================== ================================
Generating URLs
------------------
---------------
To generate the URL for a specific view, use *url_for* with a dot prefix::
......
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