more on docs

This commit is contained in:
Artur Barseghyan 2017-05-15 22:41:03 +02:00
parent 5dad1c9ac6
commit 481f61844a
6 changed files with 149 additions and 151 deletions

View file

@ -1,16 +1,16 @@
fobi.contrib.apps.mezzanine_integration
=======================================
---------------------------------------
A ``django-fobi`` integration with Mezzanine.
Installation
------------
~~~~~~~~~~~~
Versions
~~~~~~~~
########
See the `requirements file
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/mezzanine_example/requirements.txt>`_.
your_project/settings.py
~~~~~~~~~~~~~~~~~~~~~~~~
########################
See the `example settings file
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/mezzanine_example/settings.py>`_.
@ -24,9 +24,9 @@ See the `example settings file
]
Information for developers
--------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~
Template rendering
~~~~~~~~~~~~~~~~~~
##################
The form embed into Mezzanine page is rendered with use of two theme templates:
- ``view_embed_form_entry_ajax_template``: Used for rendering the form.
@ -34,7 +34,7 @@ The form embed into Mezzanine page is rendered with use of two theme templates:
sent event.
Using custom templates for rendering the form
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#############################################
In the widget, you can specify a template which you want to be used for
rendering the form or the form-sent event.
@ -95,9 +95,9 @@ example below.
}
Usage
-----
~~~~~
The ``fobi`` page model
~~~~~~~~~~~~~~~~~~~~~~~
#######################
The ``fobi.contrib.apps.mezzanine_integration.models.FobiFormPage`` consists
of the following fields:
@ -113,16 +113,13 @@ of the following fields:
- Success page text: Overrides the form-sent text.
Steps described
~~~~~~~~~~~~~~~
###############
1. If you use the mezzanine `example
<https://github.com/barseghyanartur/django-fobi/blob/stable/examples/mezzanine_example/>`_
project, to start go to the http://localhost:8003/fobi/ URL and create a
form.
2. Then go to http://localhost:8003/admin/pages/page/ and add a new `Fobi form`
page.
3. Choose the form and optionally - override the form settings and then
save the page.
4. See the page in the front-end.

View file

@ -1,32 +1,32 @@
fobi.contrib.plugins.form_elements.content.content_image
========================================================
--------------------------------------------------------
A ``Fobi`` Image form element plugin.
Installation
------------
1. Add ``fobi.contrib.plugins.form_elements.content.content_image`` to the
``INSTALLED_APPS`` in your ``settings.py``.
~~~~~~~~~~~~
(1) Add ``fobi.contrib.plugins.form_elements.content.content_image`` to the
``INSTALLED_APPS`` in your ``settings.py``.
.. code-block:: python
.. code-block:: python
INSTALLED_APPS = (
# ...
'easy_thumbnails',
'fobi.contrib.plugins.form_elements.content.content_image',
# ...
)
INSTALLED_APPS = (
# ...
'easy_thumbnails',
'fobi.contrib.plugins.form_elements.content.content_image',
# ...
)
2. In the terminal type:
(2) In the terminal type:
.. code-block:: sh
.. code-block:: sh
./manage.py fobi_sync_plugins
./manage.py fobi_sync_plugins
3. Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
(3) Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
4. Additionally, for the fine tuning, see the
``fobi.contrib.plugins.form_elements.content.content_image.defaults``
module. If necessary, override the settings by prepending
``FOBI_PLUGIN_CONTENT_IMAGE_`` to the desired variable name from the
above mentioned ``defaults`` module.
(4) Additionally, for the fine tuning, see the
``fobi.contrib.plugins.form_elements.content.content_image.defaults``
module. If necessary, override the settings by prepending
``FOBI_PLUGIN_CONTENT_IMAGE_`` to the desired variable name from the
above mentioned ``defaults`` module.

View file

@ -1,66 +1,66 @@
fobi.contrib.plugins.form_elements.content.content_text
=======================================================
-------------------------------------------------------
A ``Fobi`` Text form element plugin.
Installation
------------
1. Add ``fobi.contrib.plugins.form_elements.content.content_text`` to the
``INSTALLED_APPS`` in your ``settings.py``.
~~~~~~~~~~~~
(1) Add ``fobi.contrib.plugins.form_elements.content.content_text`` to the
``INSTALLED_APPS`` in your ``settings.py``.
.. code-block:: python
.. code-block:: python
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.content.content_text',
# ...
)
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.content.content_text',
# ...
)
2. In the terminal type:
(2) In the terminal type:
.. code-block:: sh
.. code-block:: sh
./manage.py fobi_sync_plugins
./manage.py fobi_sync_plugins
3. Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
(3) Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
4. Additionally, for the fine tuning, see the
``fobi.contrib.plugins.form_elements.content.content_text.defaults``
module. If necessary, override the settings by prepending
``FOBI_PLUGIN_CONTENT_TEXT_`` to the desired variable name from the
above mentioned ``defaults`` module.
(4) Additionally, for the fine tuning, see the
``fobi.contrib.plugins.form_elements.content.content_text.defaults``
module. If necessary, override the settings by prepending
``FOBI_PLUGIN_CONTENT_TEXT_`` to the desired variable name from the
above mentioned ``defaults`` module.
By default the content of the text field is stripped using either the
awesome `bleach <https://bleach.readthedocs.io/>`_ library or if bleach
is not installed just Django's own `strip_tags` function. To configure
the strip (bleach only) behaviour, two settings are introduced:
By default the content of the text field is stripped using either the
awesome `bleach <https://bleach.readthedocs.io/>`_ library or if bleach
is not installed just Django's own `strip_tags` function. To configure
the strip (bleach only) behaviour, two settings are introduced:
.. code-block:: text
.. code-block:: text
- ALLOWED_TAGS:
- ALLOWED_ATTRIBUTES:
- ALLOWED_TAGS:
- ALLOWED_ATTRIBUTES:
The default values are:
The default values are:
.. code-block:: python
.. code-block:: python
ALLOWED_TAGS = [
'a',
'abbr',
'acronym',
'b',
'blockquote',
'code',
'em',
'i',
'li',
'ol',
'strong',
'ul',
]
ALLOWED_TAGS = [
'a',
'abbr',
'acronym',
'b',
'blockquote',
'code',
'em',
'i',
'li',
'ol',
'strong',
'ul',
]
ALLOWED_ATTRIBUTES = {
'a': ['href', 'title'],
'abbr': ['title'],
'acronym': ['title'],
}
ALLOWED_ATTRIBUTES = {
'a': ['href', 'title'],
'abbr': ['title'],
'acronym': ['title'],
}

View file

@ -1,31 +1,31 @@
fobi.contrib.plugins.form_elements.content.content_video
========================================================
--------------------------------------------------------
A ``Fobi`` Video form element plugin.
Installation
------------
1. Add ``fobi.contrib.plugins.form_elements.content.content_video`` to the
``INSTALLED_APPS`` in your ``settings.py``.
~~~~~~~~~~~~
(1) Add ``fobi.contrib.plugins.form_elements.content.content_video`` to the
``INSTALLED_APPS`` in your ``settings.py``.
.. code-block:: python
.. code-block:: python
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.content.content_video',
# ...
)
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.content.content_video',
# ...
)
2. In the terminal type:
(2) In the terminal type:
.. code-block:: sh
.. code-block:: sh
./manage.py fobi_sync_plugins
./manage.py fobi_sync_plugins
3. Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
(3) Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
4. Additionally, for the fine tuning, see the
``fobi.contrib.plugins.form_elements.content.content_video.defaults``
module. If necessary, override the settings by prepending
``FOBI_PLUGIN_CONTENT_VIDEO_`` to the desired variable name from the
above mentioned ``defaults`` module.
(4) Additionally, for the fine tuning, see the
``fobi.contrib.plugins.form_elements.content.content_video.defaults``
module. If necessary, override the settings by prepending
``FOBI_PLUGIN_CONTENT_VIDEO_`` to the desired variable name from the
above mentioned ``defaults`` module.

View file

@ -1,26 +1,26 @@
fobi.contrib.plugins.form_elements.fields.boolean
=================================================
-------------------------------------------------
A ``Fobi`` Boolean form field plugin. Makes use of the
``django.forms.fields.BooleanField``.
Installation
------------
1. Add ``fobi.contrib.plugins.form_elements.fields.boolean`` to the
``INSTALLED_APPS`` in your ``settings.py``.
~~~~~~~~~~~~
(1) Add ``fobi.contrib.plugins.form_elements.fields.boolean`` to the
``INSTALLED_APPS`` in your ``settings.py``.
.. code-block:: python
.. code-block:: python
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.fields.boolean',
# ...
)
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.fields.boolean',
# ...
)
2. In the terminal type:
(2) In the terminal type:
.. code-block:: sh
.. code-block:: sh
./manage.py fobi_sync_plugins
./manage.py fobi_sync_plugins
3. Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
(3) Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.

View file

@ -1,57 +1,58 @@
fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple
==================================================================
------------------------------------------------------------------
A ``Fobi`` Select Multiple form field plugin. Makes use of the
``django.forms.fields.MultipleChoiceField`` and
``django.forms.widgets.CheckboxSelectMultiple``.
Installation
------------
1. Add ``fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple``
to the ``INSTALLED_APPS`` in your ``settings.py``.
~~~~~~~~~~~~
(1) Add ``fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple``
to the ``INSTALLED_APPS`` in your ``settings.py``.
.. code-block:: python
.. code-block:: python
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple',
# ...
)
INSTALLED_APPS = (
# ...
'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple',
# ...
)
2. In the terminal type:
(2) In the terminal type:
.. code-block:: sh
.. code-block:: sh
./manage.py fobi_sync_plugins
./manage.py fobi_sync_plugins
3. Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
(3) Assign appropriate permissions to the target users/groups to be using
the plugin if ``FOBI_RESTRICT_PLUGIN_ACCESS`` is set to True.
4. By default, the submitted form value of `select_multiple`
elements is label (human readable representation of the value chosen).
However, that part of the behaviour has been made configurable. You can
choose between the following options:
(4) By default, the submitted form value of `select_multiple`
elements is label (human readable representation of the value chosen).
However, that part of the behaviour has been made configurable. You can
choose between the following options:
Consider the following list of (value, label) choices (the first element in
the tuple is value, the second element is label):
Consider the following list of (value, label) choices (the first element in
the tuple is value, the second element is label):
.. code-block:: python
.. code-block:: python
[
('alpha', 'Alpha'),
('beta', 'Beta'),
('gamma', 'Gamma'),
]
[
('alpha', 'Alpha'),
('beta', 'Beta'),
('gamma', 'Gamma'),
]
- "val": `value` (example: "alpha").
- "repr" (default): `label` (example: "Alpha").
- "mix": `value (label)` (example: "Alpha (alpha)").
- "val": `value` (example: "alpha").
- "repr" (default): `label` (example: "Alpha").
- "mix": `value (label)` (example: "Alpha (alpha)").
Simply set the
``FOBI_FORM_ELEMENT_CHECKBOX_SELECT_MULTIPLE_SUBMIT_VALUE_AS`` assign one of
the following values: "val", "repr" or "mix" to get the desired behaviour.
Simply set the
``FOBI_FORM_ELEMENT_CHECKBOX_SELECT_MULTIPLE_SUBMIT_VALUE_AS`` assign one
of the following values: "val", "repr" or "mix" to get the desired
behaviour.
Usage
-----
~~~~~
You should be entering a single choice per line. Choice might
consist of just a single value or value/label pair.