Commit 459410a3 authored by Serge S. Koval's avatar Serge S. Koval

Documentation fixes

parent 45f2a00d
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
{% set page_width = '940px' %} {% set page_width = '940px' %}
{% set sidebar_width = '220px' %} {% set sidebar_width = '220px' %}
@import url("basic.css"); @import url("basic.css");
/* -- page layout ----------------------------------------------------------- */ /* -- page layout ----------------------------------------------------------- */
body { body {
font-family: 'Georgia', serif; font-family: 'Georgia', serif;
font-size: 17px; font-size: 17px;
...@@ -40,10 +40,14 @@ div.sphinxsidebar { ...@@ -40,10 +40,14 @@ div.sphinxsidebar {
width: {{ sidebar_width }}; width: {{ sidebar_width }};
} }
div.sphinxsidebar span.pre {
word-wrap: break-word;
}
hr { hr {
border: 1px solid #B1B4B6; border: 1px solid #B1B4B6;
} }
div.body { div.body {
background-color: #ffffff; background-color: #ffffff;
color: #3E4349; color: #3E4349;
...@@ -54,7 +58,7 @@ img.floatingflask { ...@@ -54,7 +58,7 @@ img.floatingflask {
padding: 0 0 10px 10px; padding: 0 0 10px 10px;
float: right; float: right;
} }
div.footer { div.footer {
width: {{ page_width }}; width: {{ page_width }};
margin: 20px auto 30px auto; margin: 20px auto 30px auto;
...@@ -70,7 +74,7 @@ div.footer a { ...@@ -70,7 +74,7 @@ div.footer a {
div.related { div.related {
display: none; display: none;
} }
div.sphinxsidebar a { div.sphinxsidebar a {
color: #444; color: #444;
text-decoration: none; text-decoration: none;
...@@ -80,7 +84,7 @@ div.sphinxsidebar a { ...@@ -80,7 +84,7 @@ div.sphinxsidebar a {
div.sphinxsidebar a:hover { div.sphinxsidebar a:hover {
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
} }
div.sphinxsidebar { div.sphinxsidebar {
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
...@@ -95,7 +99,7 @@ div.sphinxsidebarwrapper p.logo { ...@@ -95,7 +99,7 @@ div.sphinxsidebarwrapper p.logo {
margin: 0; margin: 0;
text-align: center; text-align: center;
} }
div.sphinxsidebar h3, div.sphinxsidebar h3,
div.sphinxsidebar h4 { div.sphinxsidebar h4 {
font-family: 'Garamond', 'Georgia', serif; font-family: 'Garamond', 'Georgia', serif;
...@@ -109,7 +113,7 @@ div.sphinxsidebar h4 { ...@@ -109,7 +113,7 @@ div.sphinxsidebar h4 {
div.sphinxsidebar h4 { div.sphinxsidebar h4 {
font-size: 20px; font-size: 20px;
} }
div.sphinxsidebar h3 a { div.sphinxsidebar h3 a {
color: #444; color: #444;
} }
...@@ -120,7 +124,7 @@ div.sphinxsidebar p.logo a:hover, ...@@ -120,7 +124,7 @@ div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover { div.sphinxsidebar h3 a:hover {
border: none; border: none;
} }
div.sphinxsidebar p { div.sphinxsidebar p {
color: #555; color: #555;
margin: 10px 0; margin: 10px 0;
...@@ -131,25 +135,25 @@ div.sphinxsidebar ul { ...@@ -131,25 +135,25 @@ div.sphinxsidebar ul {
padding: 0; padding: 0;
color: #000; color: #000;
} }
div.sphinxsidebar input { div.sphinxsidebar input {
border: 1px solid #ccc; border: 1px solid #ccc;
font-family: 'Georgia', serif; font-family: 'Georgia', serif;
font-size: 1em; font-size: 1em;
} }
/* -- body styles ----------------------------------------------------------- */ /* -- body styles ----------------------------------------------------------- */
a { a {
color: #004B6B; color: #004B6B;
text-decoration: underline; text-decoration: underline;
} }
a:hover { a:hover {
color: #6D4100; color: #6D4100;
text-decoration: underline; text-decoration: underline;
} }
div.body h1, div.body h1,
div.body h2, div.body h2,
div.body h3, div.body h3,
...@@ -169,25 +173,25 @@ div.indexwrapper h1 { ...@@ -169,25 +173,25 @@ div.indexwrapper h1 {
height: {{ theme_index_logo_height }}; height: {{ theme_index_logo_height }};
} }
{% endif %} {% endif %}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; } div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; } div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; } div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; } div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; } div.body h6 { font-size: 100%; }
a.headerlink { a.headerlink {
color: #ddd; color: #ddd;
padding: 0 4px; padding: 0 4px;
text-decoration: none; text-decoration: none;
} }
a.headerlink:hover { a.headerlink:hover {
color: #444; color: #444;
background: #eaeaea; background: #eaeaea;
} }
div.body p, div.body dd, div.body li { div.body p, div.body dd, div.body li {
line-height: 1.4em; line-height: 1.4em;
} }
...@@ -234,20 +238,20 @@ div.note { ...@@ -234,20 +238,20 @@ div.note {
background-color: #eee; background-color: #eee;
border: 1px solid #ccc; border: 1px solid #ccc;
} }
div.seealso { div.seealso {
background-color: #ffc; background-color: #ffc;
border: 1px solid #ff6; border: 1px solid #ff6;
} }
div.topic { div.topic {
background-color: #eee; background-color: #eee;
} }
p.admonition-title { p.admonition-title {
display: inline; display: inline;
} }
p.admonition-title:after { p.admonition-title:after {
content: ":"; content: ":";
} }
...@@ -341,7 +345,7 @@ ul, ol { ...@@ -341,7 +345,7 @@ ul, ol {
margin: 10px 0 10px 30px; margin: 10px 0 10px 30px;
padding: 0; padding: 0;
} }
pre { pre {
background: #eee; background: #eee;
padding: 7px 30px; padding: 7px 30px;
...@@ -358,7 +362,7 @@ dl dl pre { ...@@ -358,7 +362,7 @@ dl dl pre {
margin-left: -90px; margin-left: -90px;
padding-left: 90px; padding-left: 90px;
} }
tt { tt {
background-color: #ecf0f3; background-color: #ecf0f3;
color: #222; color: #222;
......
...@@ -7,4 +7,4 @@ pygments_style = flask_theme_support.FlaskyStyle ...@@ -7,4 +7,4 @@ pygments_style = flask_theme_support.FlaskyStyle
index_logo = index_logo =
index_logo_height = 120px index_logo_height = 120px
touch_icon = touch_icon =
github_fork = 'MrJoes/Flask-AdminEx' github_fork = 'mrjoes/flask-admin'
...@@ -5,8 +5,11 @@ API ...@@ -5,8 +5,11 @@ API
:maxdepth: 2 :maxdepth: 2
mod_base mod_base
mod_helpers
mod_model mod_model
mod_form mod_form
mod_form_fields
mod_form_upload
mod_tools mod_tools
mod_actions mod_actions
...@@ -14,4 +17,6 @@ API ...@@ -14,4 +17,6 @@ API
mod_contrib_mongoengine mod_contrib_mongoengine
mod_contrib_peewee mod_contrib_peewee
mod_contrib_pymongo mod_contrib_pymongo
mod_contrib_fileadmin mod_contrib_fileadmin
\ No newline at end of file
mod_model_template
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
:members: :members:
:exclude-members: can_upload, can_delete, can_delete_dirs, can_mkdir, can_rename, :exclude-members: can_upload, can_delete, can_delete_dirs, can_mkdir, can_rename,
allowed_extensions, list_template, upload_template, mkdir_template, allowed_extensions, list_template, upload_template, mkdir_template,
rename_template rename_template, editable_extensions, edit_templat
.. autoattribute:: can_upload .. autoattribute:: can_upload
.. autoattribute:: can_delete .. autoattribute:: can_delete
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
.. autoattribute:: can_mkdir .. autoattribute:: can_mkdir
.. autoattribute:: can_rename .. autoattribute:: can_rename
.. autoattribute:: allowed_extensions .. autoattribute:: allowed_extensions
.. autoattribute:: editable_extensions
.. autoattribute:: list_template .. autoattribute:: list_template
.. autoattribute:: upload_template .. autoattribute:: upload_template
.. autoattribute:: mkdir_template .. autoattribute:: mkdir_template
.. autoattribute:: rename_template .. autoattribute:: rename_template
.. autoattribute:: edit_template
...@@ -8,9 +8,9 @@ MongoEngine model backend implementation. ...@@ -8,9 +8,9 @@ MongoEngine model backend implementation.
.. autoclass:: ModelView .. autoclass:: ModelView
:members: :members:
:inherited-members: :inherited-members:
:exclude-members: column_filters, column_type_formatter, :exclude-members: column_filters, column_type_formatters,
filter_converter, model_form_converter filter_converter, model_form_converter
allowed_search_types, form_subdocuments
Class inherits configuration options from :class:`~flask.ext.admin.model.BaseModelView` and they're not displayed here. Class inherits configuration options from :class:`~flask.ext.admin.model.BaseModelView` and they're not displayed here.
...@@ -18,3 +18,5 @@ MongoEngine model backend implementation. ...@@ -18,3 +18,5 @@ MongoEngine model backend implementation.
.. autoattribute:: column_type_formatters .. autoattribute:: column_type_formatters
.. autoattribute:: filter_converter .. autoattribute:: filter_converter
.. autoattribute:: model_form_converter .. autoattribute:: model_form_converter
.. autoattribute:: allowed_search_types
.. autoattribute:: form_subdocuments
...@@ -12,7 +12,8 @@ SQLAlchemy model backend implementation. ...@@ -12,7 +12,8 @@ SQLAlchemy model backend implementation.
column_select_related_list, column_searchable_list, column_select_related_list, column_searchable_list,
column_filters, filter_converter, model_form_converter, column_filters, filter_converter, model_form_converter,
inline_model_form_converter, fast_mass_delete, inline_model_form_converter, fast_mass_delete,
inline_models inline_models, form_choices,
form_optional_types
Class inherits configuration options from :class:`~flask.ext.admin.model.BaseModelView` and they're not displayed here. Class inherits configuration options from :class:`~flask.ext.admin.model.BaseModelView` and they're not displayed here.
...@@ -25,3 +26,5 @@ SQLAlchemy model backend implementation. ...@@ -25,3 +26,5 @@ SQLAlchemy model backend implementation.
.. autoattribute:: inline_model_form_converter .. autoattribute:: inline_model_form_converter
.. autoattribute:: fast_mass_delete .. autoattribute:: fast_mass_delete
.. autoattribute:: inline_models .. autoattribute:: inline_models
.. autoattribute:: form_choices
.. autoattribute:: form_optional_types
``flask.ext.admin.form.fields``
===============================
.. automodule:: flask.ext.admin.form.fields
.. autoclass:: TimeField
:members:
.. autoclass:: Select2Field
:members:
.. autoclass:: Select2TagsField
:members:
``flask.ext.admin.form.upload``
===============================
.. automodule:: flask.ext.admin.form.upload
.. autoclass:: FileUploadField
:members:
.. autoclass:: ImageUploadField
:members:
.. autoclass:: FileUploadInput
:members:
.. autoclass:: ImageUploadInput
:members:
``flask.ext.admin.helpers``
===========================
.. automodule:: flask.ext.admin.helpers
.. autofunction:: get_current_view
Forms
.. autofunction:: is_required_form_field
.. autofunction:: is_form_submitted
.. autofunction:: validate_form_on_submit
.. autofunction:: get_form_data
.. autofunction:: is_field_error
Jinja2 helpers
.. autofunction:: resolve_ctx
.. autofunction:: get_render_ctx
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
.. autoattribute:: column_list .. autoattribute:: column_list
.. autoattribute:: column_exclude_list .. autoattribute:: column_exclude_list
.. autoattribute:: column_labels .. autoattribute:: column_labels
:: autoattribute:: column_descriptions .. autoattribute:: column_descriptions
.. autoattribute:: column_formatters .. autoattribute:: column_formatters
.. autoattribute:: column_type_formatters .. autoattribute:: column_type_formatters
.. autoattribute:: column_display_pk .. autoattribute:: column_display_pk
......
``flask.ext.admin.model.template``
==================================
.. automodule:: flask.ext.admin.model.template
.. autofunction:: macro
Changelog Changelog
========= =========
1.0.7
-----
Full change log and feature walkthrough can be found `here <http://mrjoes.github.com/TBD>`_.
Highlights:
* Python 3 support
* AJAX-based foreign-key data loading for all backends
* New, optional, rule-based form rendering engine
* MongoEngine fixes and features: GridFS support, nested subdocument configuration and much more
* Greatly improved and more configurable inline models
* New WTForms fields and widgets
* `form_extra_columns` allows adding custom columns to the form declaratively
* Redis cli
* SQLAlchemy backend can handle inherited models with multiple PKs
* Lots of bug fixes
1.0.6 1.0.6
----- -----
...@@ -32,46 +50,3 @@ Changelog ...@@ -32,46 +50,3 @@ Changelog
* German translation (WIP) * German translation (WIP)
* Updated documentation * Updated documentation
* Lots of bug fixes * Lots of bug fixes
1.0.4
-----
* MongoEngine support
* Raw PyMongo support
* Model property names are more consistent now
* Revamped InlineForm implementation
* Proper support of SQLAlchemy model inheritance
* Updated to bootstrap 2.2.1
1.0.3
-----
General:
* Peewee 2.x support
* Model form scaffolding is now customizable in model views
* Inline model forms are much more customizable now
* List view type-based formatters
* Database ``NULL`` will be displayed in list view as empty string by default. Use type-based formatter if you want to show something else.
* `Use Select2 <http://ivaynberg.github.com/select2/>`_ instead of Chosen
* List view formatting callbacks. See `example <https://gist.github.com/3714266>`_.
* ``_template_args`` property is now available in all views
* ``on_model_change`` and ``on_model_delete`` callbacks
* Model backends now support ``list_display_pk`` property
* Minor template refactoring, more blocks to override
* Supported multiple ``Admin`` class instances for one Flask application
* File uploads are now supported in model views
* Use HTTPS CDN for jQuery
* Lots of minor fixes
SQLAlchemy backend:
* Support for non-nullable boolean fields
* If create/delete/update fails, Flask-Admin will rollback the transaction
* Default column values support
* ``list_display_all_relations`` to show many-to-one relations in list view
* ``get_query`` method, which can be overridden to implement additional filtering/sorting/etc
* Synonym properties support
* Backend will ignore protected fields (name starting with underscore) from now on
* Support for various PostgreSQL fields
...@@ -43,7 +43,7 @@ master_doc = 'index' ...@@ -43,7 +43,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'flask-admin' project = u'flask-admin'
copyright = u'2012, Serge S. Koval' copyright = u'2012-2013, Serge S. Koval'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
...@@ -76,7 +76,7 @@ exclude_patterns = [] ...@@ -76,7 +76,7 @@ exclude_patterns = []
# If true, the current module name will be prepended to all description # If true, the current module name will be prepended to all description
# unit titles (such as .. function::). # unit titles (such as .. function::).
#add_module_names = True add_module_names = False
# If true, sectionauthor and moduleauthor directives will be shown in the # If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default. # output. They are ignored by default.
......
...@@ -18,16 +18,20 @@ All Flask-Admin templates should derive from `admin/master.html`. ...@@ -18,16 +18,20 @@ All Flask-Admin templates should derive from `admin/master.html`.
`admin/master.html` is a proxy which points to `admin/base.html`. It contains following blocks: `admin/master.html` is a proxy which points to `admin/base.html`. It contains following blocks:
============= ======================================================================== ============== ========================================================================
head_meta Page metadata in the header head_meta Page metadata in the header
title Page title title Page title
head_css Various CSS includes in the header head_css Various CSS includes in the header
head Empty block in HTML head, in case you want to put something there head Empty block in HTML head, in case you want to put something there
page_body Page layout page_body Page layout
brand Logo in the menu bar brand Logo in the menu bar
body Content (that's where your view will be displayed) main_menu Main menu
tail Empty area below content menu_links Links menu
============= ======================================================================== access_control Section to the right of the menu (can be used to add login/logout buttons)
messages Alerts and various messages
body Content (that's where your view will be displayed)
tail Empty area below content
============== ========================================================================
`admin/index.html` will be used display default `Home` admin page. By default it is empty. `admin/index.html` will be used display default `Home` admin page. By default it is empty.
...@@ -38,17 +42,33 @@ There are 3 main templates that are used to display models: ...@@ -38,17 +42,33 @@ There are 3 main templates that are used to display models:
`admin/model/list.html` is list view template and contains following blocks: `admin/model/list.html` is list view template and contains following blocks:
================= ============================================ ======================= ============================================
model_menu_bar Menu bar model_menu_bar Menu bar
model_list_table Table container model_list_table Table container
list_header Table header row list_header Table header row
list_row Row block list_row_actions_header Actions header
list_row_actions Row action cell with edit/remove/etc buttons list_row Single row
================= ============================================ list_row_actions Row action cell with edit/remove/etc buttons
empty_list_message Message that will be displayed if there are no models found
======================= ============================================
`admin/model/create.html` and `admin/model/edit.html` are used to display model creation editing forms respectively. They don't contain any custom `admin/model/create.html` and `admin/model/edit.html` are used to display model creation editing forms respectively. They don't contain any custom
blocks and if you want to change something, you can do it using any of the blocks found in `admin/master.html`. blocks and if you want to change something, you can do it using any of the blocks found in `admin/master.html`.
Environment variables
---------------------
There are few variables and methods that are always accessible in administrative templates:
==================== ================================
admin_view Current administrative view
admin_base_template Base template name
_gettext Babel gettext
_ngettext Babel ngettext
h Helpers from :mod:`~flask.ext.admin.helpers` module
==================== ================================
Customizing templates Customizing templates
--------------------- ---------------------
......
...@@ -130,7 +130,7 @@ class ModelView(BaseModelView): ...@@ -130,7 +130,7 @@ class ModelView(BaseModelView):
In this example, `Post` model has child `Comment` subdocument. When generating form for `Comment` embedded In this example, `Post` model has child `Comment` subdocument. When generating form for `Comment` embedded
document, Flask-Admin will only create `name` field. document, Flask-Admin will only create `name` field.
It is also possible to use class-based embedded document configuration: It is also possible to use class-based embedded document configuration::
class CommentEmbed(EmbeddedForm): class CommentEmbed(EmbeddedForm):
form_columns = ('name',) form_columns = ('name',)
......
...@@ -60,7 +60,7 @@ def get_form_data(): ...@@ -60,7 +60,7 @@ def get_form_data():
def is_field_error(errors): def is_field_error(errors):
""" """
Check if wtforms field has direct error. Check if wtforms field has error without checking its children.
:param errors: :param errors:
Errors list. Errors list.
......
...@@ -41,7 +41,9 @@ ...@@ -41,7 +41,9 @@
</div> </div>
</div> </div>
{% block messages %}
{{ layout.messages() }} {{ layout.messages() }}
{% endblock %}
{% set render_ctx = h.resolve_ctx() %} {% set render_ctx = h.resolve_ctx() %}
......
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