From cdb0b27be9833edd2df12d09a405b9e12fed43be Mon Sep 17 00:00:00 2001 From: "Petrus J.v.Rensburg" Date: Sun, 5 Jul 2015 12:02:12 +0200 Subject: [PATCH] Final big edit for 'advanced' page. --- doc/adding_a_new_model_backend.rst | 2 + doc/advanced.rst | 221 +++++++++-------------------- 2 files changed, 66 insertions(+), 157 deletions(-) diff --git a/doc/adding_a_new_model_backend.rst b/doc/adding_a_new_model_backend.rst index e74ab7374..445b11632 100644 --- a/doc/adding_a_new_model_backend.rst +++ b/doc/adding_a_new_model_backend.rst @@ -1,3 +1,5 @@ +.. _adding-model-backend: + Adding a Model Backend ========================== diff --git a/doc/advanced.rst b/doc/advanced.rst index 1d3ae0b6d..37a7c172e 100644 --- a/doc/advanced.rst +++ b/doc/advanced.rst @@ -10,12 +10,12 @@ Replacing Individual Form Fields **** The `form_overrides` attribute allows you to replace individual fields within a form. -A common use-case for this would be to add a rich text editor, or to handle +A common use-case for this would be to add a *What-You-See-Is-What-You-Get* (WYSIWIG) editor, or to handle file / image uploads that need to be tied to a field in your model. -Rich-Text Fields +WYSIWIG Text Fields ********************** -To handle complicated text content, use a *WYSIWIG* text editor, like +To handle complicated text content, you can use `CKEditor `_ by subclassing some of the builtin WTForms classes as follows:: @@ -48,15 +48,17 @@ functionality by including the necessary CKEditor javascript on the `create` and {% block tail %} {{ super() }} - + {% endblock %} File & Image Fields ******************* -Flask-Admin comes with a builtin `FileUploadField` and `ImageUploadField`. To make use +Flask-Admin comes with a builtin :meth:`~flask_admin.form.upload.FileUploadField` +and :meth:`~flask_admin.form.upload.ImageUploadField`. To make use of them, you'll need to specify an upload directory, and add them to the forms in question. -Image handling also requires you to have `Pillow `_ installed. +Image handling also requires you to have `Pillow `_ +installed if you need to do any processing on the image files. Have a look at the example at https://github.com/flask-admin/Flask-Admin/tree/master/examples/forms. @@ -72,7 +74,8 @@ Localization with Flask-Babelex **** -Enabling localization is relatively simple. +Flask-Admin comes with translations built-in for several languages. +Enabling localization is simple:: #. Install `Flask-BabelEx `_ to do the heavy lifting. It's a fork of the @@ -122,7 +125,7 @@ can use it by adding a FileAdmin view to your app:: # Flask setup here - admin = Admin(app) + admin = Admin(app, name='microblog', template_mode='bootstrap3') path = op.join(op.dirname(__file__), 'static') admin.add_view(FileAdmin(path, '/static/', name='Static Files')) @@ -136,19 +139,20 @@ Managing geographical models with the GeoAlchemy backend **** If you want to store spatial information in a GIS database, Flask-Admin has -you covered. The `GeoAlchemy`_ backend extends the SQLAlchemy backend (just as +you covered. The `GeoAlchemy `_ backend +extends the SQLAlchemy backend (just as GeoAlchemy extends SQLAlchemy) to give you a pretty and functional map-based editor for your admin pages. Some notable features include: - - Maps are displayed using the amazing `Leaflet`_ Javascript library, - with map data from `Mapbox`_. + - Maps are displayed using the amazing `Leaflet `_ Javascript library, + with map data from `Mapbox `_. - Geographic information, including points, lines and polygons, can be edited - interactively using `Leaflet.Draw`_. - - Graceful fallback: `GeoJSON`_ data can be edited in a ``