mirror of
https://github.com/Hopiu/django-fobi.git
synced 2026-05-10 22:03:09 +00:00
Merge branch 'master' of github.com:barseghyanartur/django-fobi
This commit is contained in:
commit
67f7fc5f1e
19 changed files with 410 additions and 183 deletions
|
|
@ -9,7 +9,6 @@ Subpackages
|
|||
fobi.contrib.apps.djangocms_integration
|
||||
fobi.contrib.apps.feincms_integration
|
||||
fobi.contrib.apps.mezzanine_integration
|
||||
fobi.contrib.apps.wagtail_integration
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
fobi.contrib.apps.wagtail_integration package
|
||||
=============================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.contrib.apps.wagtail_integration.apps module
|
||||
-------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.apps.wagtail_integration.apps
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.apps.wagtail_integration.conf module
|
||||
-------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.apps.wagtail_integration.conf
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.apps.wagtail_integration.defaults module
|
||||
-----------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.apps.wagtail_integration.defaults
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.apps.wagtail_integration.helpers module
|
||||
----------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.apps.wagtail_integration.helpers
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.apps.wagtail_integration.models module
|
||||
---------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.apps.wagtail_integration.models
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.apps.wagtail_integration.settings module
|
||||
-----------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.apps.wagtail_integration.settings
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.contrib.apps.wagtail_integration
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
fobi.contrib.plugins.form_elements.fields.hidden_model_object package
|
||||
=====================================================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.hidden_model_object.apps module
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.hidden_model_object.apps
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.hidden_model_object.conf module
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.hidden_model_object.conf
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.hidden_model_object.defaults module
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.hidden_model_object.defaults
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.hidden_model_object.fobi_form_elements module
|
||||
---------------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.hidden_model_object.fobi_form_elements
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.hidden_model_object.forms module
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.hidden_model_object.forms
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.hidden_model_object.settings module
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.hidden_model_object.settings
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.hidden_model_object
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
|
@ -16,7 +16,6 @@ Subpackages
|
|||
fobi.contrib.plugins.form_elements.fields.file
|
||||
fobi.contrib.plugins.form_elements.fields.float
|
||||
fobi.contrib.plugins.form_elements.fields.hidden
|
||||
fobi.contrib.plugins.form_elements.fields.hidden_model_object
|
||||
fobi.contrib.plugins.form_elements.fields.input
|
||||
fobi.contrib.plugins.form_elements.fields.integer
|
||||
fobi.contrib.plugins.form_elements.fields.ip_address
|
||||
|
|
@ -30,6 +29,7 @@ Subpackages
|
|||
fobi.contrib.plugins.form_elements.fields.select_multiple
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max
|
||||
fobi.contrib.plugins.form_elements.fields.slug
|
||||
fobi.contrib.plugins.form_elements.fields.text
|
||||
fobi.contrib.plugins.form_elements.fields.textarea
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max package
|
||||
==========================================================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.apps module
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.apps
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.conf module
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.conf
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.defaults module
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.defaults
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.fields module
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.fields
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.fobi_form_elements module
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.fobi_form_elements
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.forms module
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.forms
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.settings module
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max.settings
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_elements.fields.select_multiple_with_max
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
fobi.contrib.plugins.form_handlers.db_store.migrations package
|
||||
==============================================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.contrib.plugins.form_handlers.db_store.migrations.0001_initial module
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_handlers.db_store.migrations.0001_initial
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_handlers.db_store.migrations.0002_savedformwizarddataentry module
|
||||
-------------------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_handlers.db_store.migrations.0002_savedformwizarddataentry
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_handlers.db_store.migrations
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
|
@ -1,6 +1,14 @@
|
|||
fobi.contrib.plugins.form_handlers.db_store package
|
||||
===================================================
|
||||
|
||||
Subpackages
|
||||
-----------
|
||||
|
||||
.. toctree::
|
||||
|
||||
fobi.contrib.plugins.form_handlers.db_store.migrations
|
||||
fobi.contrib.plugins.form_handlers.db_store.urls
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
|
|
@ -68,14 +76,6 @@ fobi.contrib.plugins.form_handlers.db_store.settings module
|
|||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_handlers.db_store.urls module
|
||||
-------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_handlers.db_store.urls
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_handlers.db_store.views module
|
||||
--------------------------------------------------------
|
||||
|
||||
|
|
|
|||
30
docs/fobi.contrib.plugins.form_handlers.db_store.urls.rst
Normal file
30
docs/fobi.contrib.plugins.form_handlers.db_store.urls.rst
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
fobi.contrib.plugins.form_handlers.db_store.urls package
|
||||
========================================================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.contrib.plugins.form_handlers.db_store.urls.form_handlers module
|
||||
---------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_handlers.db_store.urls.form_handlers
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.contrib.plugins.form_handlers.db_store.urls.form_wizard_handlers module
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_handlers.db_store.urls.form_wizard_handlers
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.contrib.plugins.form_handlers.db_store.urls
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
94
docs/fobi.migrations.rst
Normal file
94
docs/fobi.migrations.rst
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
fobi.migrations package
|
||||
=======================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.migrations.0001_initial module
|
||||
-----------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0001_initial
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0002_auto_20150912_1744 module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0002_auto_20150912_1744
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0003_auto_20160517_1005 module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0003_auto_20160517_1005
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0004_auto_20160906_1513 module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0004_auto_20160906_1513
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0005_auto_20160908_1457 module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0005_auto_20160908_1457
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0006_auto_20160911_1549 module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0006_auto_20160911_1549
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0007_auto_20160926_1652 module
|
||||
----------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0007_auto_20160926_1652
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0008_formwizardhandlerentry module
|
||||
--------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0008_formwizardhandlerentry
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0009_formwizardentry_wizard_type module
|
||||
-------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0009_formwizardentry_wizard_type
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.migrations.0010_formwizardhandler module
|
||||
---------------------------------------------
|
||||
|
||||
.. automodule:: fobi.migrations.0010_formwizardhandler
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.migrations
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
|
@ -14,6 +14,7 @@ Subpackages
|
|||
fobi.templatetags
|
||||
fobi.tests
|
||||
fobi.urls
|
||||
fobi.wizard
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
|
|
|||
30
docs/fobi.south_migrations.rst
Normal file
30
docs/fobi.south_migrations.rst
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
fobi.south_migrations package
|
||||
=============================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.south_migrations.0001_initial module
|
||||
-----------------------------------------
|
||||
|
||||
.. automodule:: fobi.south_migrations.0001_initial
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.south_migrations.0002_auto__add_field_formentry_created__add_field_formentry_updated module
|
||||
------------------------------------------------------------------------------------------------
|
||||
|
||||
.. automodule:: fobi.south_migrations.0002_auto__add_field_formentry_created__add_field_formentry_updated
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.south_migrations
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
17
docs/fobi.wizard.rst
Normal file
17
docs/fobi.wizard.rst
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
fobi.wizard package
|
||||
===================
|
||||
|
||||
Subpackages
|
||||
-----------
|
||||
|
||||
.. toctree::
|
||||
|
||||
fobi.wizard.views
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.wizard
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
30
docs/fobi.wizard.views.rst
Normal file
30
docs/fobi.wizard.views.rst
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
fobi.wizard.views package
|
||||
=========================
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
fobi.wizard.views.dynamic module
|
||||
--------------------------------
|
||||
|
||||
.. automodule:: fobi.wizard.views.dynamic
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
fobi.wizard.views.views module
|
||||
------------------------------
|
||||
|
||||
.. automodule:: fobi.wizard.views.views
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: fobi.wizard.views
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
111
docs/index.rst
111
docs/index.rst
|
|
@ -70,6 +70,7 @@ Main features and highlights
|
|||
and "DjangoCMS admin style" theme (which is another simple theme with editing
|
||||
interface in style of `djangocms-admin-style
|
||||
<https://github.com/divio/djangocms-admin-style>`_).
|
||||
- `Form wizards`_.
|
||||
- Implemented `integration with FeinCMS
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/apps/feincms_integration>`_
|
||||
(in a form of a FeinCMS page widget).
|
||||
|
|
@ -92,8 +93,8 @@ Roadmap
|
|||
=======
|
||||
Some of the upcoming/in-development features/improvements are:
|
||||
|
||||
- Integration with `django-rest-framework` (in version 0.8).
|
||||
- Fieldsets (in version 0.9).
|
||||
- Form-wizards (in version 0.8).
|
||||
- Integration with `django-rest-framework` (in version 0.9).
|
||||
|
||||
See the `TODOS <https://raw.githubusercontent.com/barseghyanartur/django-fobi/master/TODOS.rst>`_
|
||||
for the full list of planned-, pending- in-development- or to-be-implemented
|
||||
|
|
@ -369,6 +370,8 @@ Defining the Sample textarea plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class SampleTextareaPlugin(FormFieldPlugin):
|
||||
"""Sample textarea plugin."""
|
||||
|
||||
uid = "sample_textarea"
|
||||
name = "Sample Textarea"
|
||||
form = SampleTextareaForm
|
||||
|
|
@ -423,6 +426,7 @@ Example (taken from fobi.contrib.plugins.form_elements.fields.file):
|
|||
.. code-block:: python
|
||||
|
||||
def submit_plugin_form_data(self, form_entry, request, form):
|
||||
"""Submit plugin form data."""
|
||||
# Get the file path
|
||||
file_path = form.cleaned_data.get(self.data.name, None)
|
||||
if file_path:
|
||||
|
|
@ -432,7 +436,7 @@ Example (taken from fobi.contrib.plugins.form_elements.fields.file):
|
|||
# file.
|
||||
form.cleaned_data[self.data.name] = "{0}{1}".format(
|
||||
settings.MEDIA_URL, saved_file
|
||||
)
|
||||
)
|
||||
|
||||
# It's critically important to return the ``form`` with updated
|
||||
# ``cleaned_data``
|
||||
|
|
@ -466,6 +470,7 @@ Form for for ``SampleTextareaPlugin`` form element plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class SampleTextareaForm(forms.Form, BasePluginForm):
|
||||
"""Sample textarea form."""
|
||||
plugin_data_fields = [
|
||||
("name", ""),
|
||||
("label", ""),
|
||||
|
|
@ -494,9 +499,7 @@ See the following `example
|
|||
.. code-block:: python
|
||||
|
||||
def save_plugin_data(self, request=None):
|
||||
"""
|
||||
Saving the plugin data and moving the file.
|
||||
"""
|
||||
"""Saving the plugin data and moving the file."""
|
||||
file_path = self.cleaned_data.get('file', None)
|
||||
if file_path:
|
||||
saved_image = handle_uploaded_file(IMAGES_UPLOAD_DIR, file_path)
|
||||
|
|
@ -515,6 +518,8 @@ Defining the base plugin widget.
|
|||
.. code-block:: python
|
||||
|
||||
class BaseSampleTextareaPluginWidget(FormElementPluginWidget):
|
||||
"""Base sample textarea plugin widget."""
|
||||
|
||||
# Same as ``uid`` value of the ``SampleTextareaPlugin``.
|
||||
plugin_uid = "sample_textarea"
|
||||
|
||||
|
|
@ -535,6 +540,8 @@ Define the theme specific plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class SampleTextareaPluginWidget(BaseSampleTextareaPluginWidget):
|
||||
"""Sample textarea plugin widget."""
|
||||
|
||||
theme_uid = 'bootstrap3' # Theme for which the widget is loaded
|
||||
media_js = ['sample_layout/js/fobi.plugins.form_elements.sample_textarea.js',]
|
||||
media_css = ['sample_layout/css/fobi.plugins.form_elements.sample_textarea.css',]
|
||||
|
|
@ -628,18 +635,21 @@ Defining the Sample mail handler plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class SampleMailHandlerPlugin(FormHandlerPlugin):
|
||||
"""Sample mail handler plugin."""
|
||||
|
||||
uid = "sample_mail"
|
||||
name = _("Sample mail")
|
||||
form = SampleMailForm
|
||||
|
||||
def run(self, form_entry, request, form):
|
||||
"""To be executed by handler."""
|
||||
send_mail(
|
||||
self.data.subject,
|
||||
json.dumps(form.cleaned_data),
|
||||
self.data.from_email,
|
||||
[self.data.to_email],
|
||||
fail_silently = True
|
||||
)
|
||||
fail_silently=True
|
||||
)
|
||||
|
||||
Some form handlers are configurable, some others not. In order to
|
||||
have a user friendly way of showing the form handler settings, what's
|
||||
|
|
@ -649,8 +659,7 @@ Simplest implementation of it would look as follows:
|
|||
.. code-block:: python
|
||||
|
||||
def plugin_data_repr(self):
|
||||
"""
|
||||
Human readable representation of plugin data.
|
||||
"""Human readable representation of plugin data.
|
||||
|
||||
:return string:
|
||||
"""
|
||||
|
|
@ -686,6 +695,8 @@ Defining the form for Sample mail handler plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class MailForm(forms.Form, BasePluginForm):
|
||||
"""Mail form."""
|
||||
|
||||
plugin_data_fields = [
|
||||
("from_name", ""),
|
||||
("from_email", ""),
|
||||
|
|
@ -700,7 +711,7 @@ Defining the form for Sample mail handler plugin.
|
|||
to_name = forms.CharField(label=_("To name"), required=True)
|
||||
to_email = forms.EmailField(label=_("To email"), required=True)
|
||||
subject = forms.CharField(label=_("Subject"), required=True)
|
||||
body = forms.CharField(label=_("Body"), required = False,
|
||||
body = forms.CharField(label=_("Body"), required=False,
|
||||
widget=forms.widgets.Textarea)
|
||||
|
||||
After the plugin has been processed, all its' data is available in a
|
||||
|
|
@ -749,8 +760,7 @@ The following example is taken from the "db_store" plugin.
|
|||
.. code-block:: python
|
||||
|
||||
def custom_actions(self):
|
||||
"""
|
||||
Adding a link to view the saved form enties.
|
||||
"""Adding a link to view the saved form entries.
|
||||
|
||||
:return iterable:
|
||||
"""
|
||||
|
|
@ -836,6 +846,8 @@ Defining the Sample importer plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class SampleImporterPlugin(FormHandlerPlugin):
|
||||
"""Sample importer plugin."""
|
||||
|
||||
uid = 'sample_importer'
|
||||
name = _("Sample importer)
|
||||
wizard = SampleImporterWizardView
|
||||
|
|
@ -905,21 +917,17 @@ Defining the form for Sample importer plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class SampleImporterStep1Form(forms.Form):
|
||||
"""
|
||||
First form the the wizard.
|
||||
"""
|
||||
"""First form the the wizard."""
|
||||
|
||||
api_key = forms.CharField(required=True)
|
||||
|
||||
|
||||
class SampleImporterStep2Form(forms.Form):
|
||||
"""
|
||||
Second form of the wizard.
|
||||
"""
|
||||
"""Second form of the wizard."""
|
||||
|
||||
list_id = forms.ChoiceField(required=True, choices=[])
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
"""
|
||||
self._api_key = None
|
||||
|
||||
if 'api_key' in kwargs:
|
||||
|
|
@ -961,13 +969,12 @@ Defining the wizard view for Sample importer plugin.
|
|||
.. code-block:: python
|
||||
|
||||
class SampleImporterWizardView(SessionWizardView):
|
||||
"""
|
||||
"""
|
||||
"""Sample importer wizard view."""
|
||||
|
||||
form_list = [SampleImporterStep1Form, SampleImporterStep2Form]
|
||||
|
||||
def get_form_kwargs(self, step):
|
||||
"""
|
||||
"""
|
||||
"""Get form kwargs (to be used internally)."""
|
||||
if '1' == step:
|
||||
data = self.get_cleaned_data_for_step('0') or {}
|
||||
api_key = data.get('api_key', None)
|
||||
|
|
@ -975,6 +982,7 @@ Defining the wizard view for Sample importer plugin.
|
|||
return {}
|
||||
|
||||
def done(self, form_list, **kwargs):
|
||||
"""After all forms are submitted."""
|
||||
# Merging cleaned data into one dict
|
||||
cleaned_data = {}
|
||||
for form in form_list:
|
||||
|
|
@ -1071,9 +1079,12 @@ Define and register the callback
|
|||
.. code-block:: python
|
||||
|
||||
class SampleFooCallback(FormCallback):
|
||||
"""Sample foo callback."""
|
||||
|
||||
stage = CALLBACK_FORM_VALID
|
||||
|
||||
def callback(self, form_entry, request, form):
|
||||
"""Define your callback code here."""
|
||||
print("Great! Your form is valid!")
|
||||
|
||||
form_callback_registry.register(SampleFooCallback)
|
||||
|
|
@ -1185,9 +1196,8 @@ See the theme example below.
|
|||
from fobi.base import BaseTheme, theme_registry
|
||||
|
||||
class SampleTheme(BaseTheme):
|
||||
"""
|
||||
Sample theme.
|
||||
"""
|
||||
"""Sample theme."""
|
||||
|
||||
uid = 'sample'
|
||||
name = _("Sample")
|
||||
|
||||
|
|
@ -1406,6 +1416,8 @@ Overriding the "simple" theme.
|
|||
from fobi.contrib.themes.simple.fobi_themes import SimpleTheme
|
||||
|
||||
class MySimpleTheme(SimpleTheme):
|
||||
"""My simple theme, inherited from `SimpleTheme` theme."""
|
||||
|
||||
html_classes = ['my-simple-theme',]
|
||||
base_view_template = 'override_simple_theme/base_view.html'
|
||||
form_ajax = 'override_simple_theme/snippets/form_ajax.html'
|
||||
|
|
@ -1448,6 +1460,36 @@ templates/override_simple_theme/snippets/form_ajax.html
|
|||
|
||||
{% block form_html_class %}basic-grey{% endblock %}
|
||||
|
||||
Form wizards
|
||||
============
|
||||
Basics
|
||||
------
|
||||
With form wizards you can split forms across multiple pages. State is
|
||||
maintained in one of the backends (at the moment the Session backend). Data
|
||||
processing is delayed until the submission of the final form.
|
||||
|
||||
In `django-fobi` wizards work in the following way:
|
||||
|
||||
- Number of forms in a form wizard is not limited.
|
||||
- Form callbacks, handlers are totally ignored in form wizards. Instead,
|
||||
the form-wizard specific handlers (form wizard handlers) take over handling
|
||||
of the form data on the final step.
|
||||
|
||||
Bundled form wizard handler plugins
|
||||
-----------------------------------
|
||||
Below a short overview of the form wizard handler plugins. See the
|
||||
README.rst file in directory of each plugin for details.
|
||||
|
||||
- `DB store
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_handlers/db_store/>`__:
|
||||
Stores form data in a database.
|
||||
- `HTTP repost
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_handlers/http_repost/>`__:
|
||||
Repost the POST request to another endpoint.
|
||||
- `Mail
|
||||
<https://github.com/barseghyanartur/django-fobi/tree/stable/src/fobi/contrib/plugins/form_handlers/mail/>`__:
|
||||
Send the form data by email.
|
||||
|
||||
Permissions
|
||||
===========
|
||||
Plugin system allows administrators to specify the access rights to every
|
||||
|
|
@ -1647,6 +1689,15 @@ of each theme for details.
|
|||
Basic theme with form editing is in a style of `djangocms-admin-style
|
||||
<https://github.com/divio/djangocms-admin-style>`_.
|
||||
|
||||
Third-party plugins and themes
|
||||
==============================
|
||||
List of remarkable third-party plugins:
|
||||
|
||||
- `fobi-phonenumber <https://pypi.python.org/pypi/fobi-phonenumber>`_ - A Fobi
|
||||
PhoneNumber form field plugin. Makes use of the
|
||||
`phonenumber_field.formfields.PhoneNumberField` and
|
||||
`phonenumber_field.widgets.PhoneNumberPrefixWidget`.
|
||||
|
||||
HTML5 fields
|
||||
============
|
||||
The following HTML5 fields are supported in corresponding bundled plugins:
|
||||
|
|
@ -1906,7 +1957,7 @@ Run the following command in order to identify the broken plugins.
|
|||
|
||||
./manage.py fobi_find_broken_entries
|
||||
|
||||
If you have forms refering to form element- of form handler- plugins
|
||||
If you have forms referring to form element- of form handler- plugins
|
||||
that are currently missing (not registered, removed, failed to load - thus
|
||||
there would be a risk that your form would't be rendered properly/fully and
|
||||
the necessary data handling wouldn't happen either) you will get an
|
||||
|
|
@ -1939,7 +1990,7 @@ Support
|
|||
For any issues contact me at the e-mail given in the `Author` section.
|
||||
|
||||
Author
|
||||
=======
|
||||
======
|
||||
Artur Barseghyan <artur.barseghyan@gmail.com>
|
||||
|
||||
Screenshots
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ if "%1" == "clean" (
|
|||
|
||||
|
||||
REM Check if sphinx-build is available and fallback to Python version if any
|
||||
%SPHINXBUILD% 1>NUL 2>NUL
|
||||
%SPHINXBUILD% 2> nul
|
||||
if errorlevel 9009 goto sphinx_python
|
||||
goto sphinx_ok
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ django-admin-tools>=0.7.1
|
|||
django-autoslug==1.9.3
|
||||
django-debug-toolbar==0.11
|
||||
django-formtools==1.0
|
||||
django-localeurl==2.0.2
|
||||
#django-localeurl==2.0.2
|
||||
django-nine>=0.1.10
|
||||
django-nonefield>=0.1
|
||||
django-registration-redux>=1.4
|
||||
|
|
|
|||
|
|
@ -2677,18 +2677,17 @@ def get_ordered_form_wizard_handler_plugins():
|
|||
|
||||
def run_form_wizard_handlers(form_wizard_entry, request, form_list,
|
||||
form_wizard, form_element_entries=None):
|
||||
"""Run form wizard handlers."""
|
||||
"""Run form handlers.
|
||||
"""Run form wizard handlers.
|
||||
|
||||
:param fobi.models.FormWizardEntry form_wizard_entry:
|
||||
:param django.http.HttpRequest request:
|
||||
:param list form_list: List of :class:`django.forms.Form` objects.
|
||||
:param fobi.wizard.views.dynamic.DynamicWizardView form_wizard: The
|
||||
form wizard view object.
|
||||
:param iterable form_element_entries: Iterable
|
||||
of :class:`fobi.base.FormElementEntry` objects.
|
||||
:return tuple: List of success responses, list of error responses
|
||||
"""
|
||||
:param fobi.models.FormWizardEntry form_wizard_entry:
|
||||
:param django.http.HttpRequest request:
|
||||
:param list form_list: List of :class:`django.forms.Form` objects.
|
||||
:param fobi.wizard.views.dynamic.DynamicWizardView form_wizard: The
|
||||
form wizard view object.
|
||||
:param iterable form_element_entries: Iterable
|
||||
of :class:`fobi.base.FormElementEntry` objects.
|
||||
:return tuple: List of success responses, list of error responses
|
||||
"""
|
||||
# Errors list
|
||||
errors = []
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ from django.core.urlresolvers import reverse
|
|||
from django.shortcuts import redirect
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from nine.versions import DJANGO_GTE_1_8
|
||||
|
||||
from fobi.wizard import SessionWizardView
|
||||
|
||||
from .forms import MailchimpAPIKeyForm, MailchimpListIDForm
|
||||
|
|
@ -29,8 +27,6 @@ class MailchimpImporterWizardView(SessionWizardView):
|
|||
|
||||
def get_form_kwargs(self, step):
|
||||
"""Get form kwargs."""
|
||||
# logger.debug('step: ' + step)
|
||||
# logger.debug(self.request.session.__dict__)
|
||||
if '1' == step:
|
||||
data = self.get_cleaned_data_for_step('0') or {}
|
||||
api_key = data.get('api_key', None)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,12 @@ __author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
|
|||
__copyright__ = '2014-2016 Artur Barseghyan'
|
||||
__license__ = 'GPL 2.0/LGPL 2.1'
|
||||
__all__ = (
|
||||
'PRINT_INFO', 'TRACK_TIME', 'print_info', 'fobi_setup', 'skip',
|
||||
'is_fobi_setup_completed', 'mark_fobi_setup_as_completed',
|
||||
'PRINT_INFO',
|
||||
'print_info',
|
||||
'fobi_setup',
|
||||
'skip',
|
||||
'is_fobi_setup_completed',
|
||||
'mark_fobi_setup_as_completed',
|
||||
)
|
||||
|
||||
# ****************************************************************************
|
||||
|
|
|
|||
Loading…
Reference in a new issue