From 16601ce3a0ec034f9da81ee2caa2de498bd51b22 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Mon, 29 May 2017 21:53:24 +0200 Subject: [PATCH 1/4] docs updated --- README.rst | 4 +--- docs/index.rst | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index a3b9db7b..669db9d9 100644 --- a/README.rst +++ b/README.rst @@ -18,9 +18,7 @@ Present Note, that Django 1.11 is not yet proclaimed to be flawlessly supported. The core and contrib packages have been tested against the Django 1.11. All tests have successfully passed, although it's yet too early -to claim that Django 1.11 is fully supported. Certain dependencies -(``django-formtools``) have been installed from source (since versions -supporting Django 1.11 are not yet released on PyPI.) +to claim that Django 1.11 is fully supported. Past ---- diff --git a/docs/index.rst b/docs/index.rst index 35cdbc8a..42803290 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,9 +18,7 @@ Present Note, that Django 1.11 is not yet proclaimed to be flawlessly supported. The core and contrib packages have been tested against the Django 1.11. All tests have successfully passed, although it's yet too early -to claim that Django 1.11 is fully supported. Certain dependencies -(``django-formtools``) have been installed from source (since versions -supporting Django 1.11 are not yet released on PyPI.) +to claim that Django 1.11 is fully supported. Past ---- @@ -270,7 +268,7 @@ Or latest stable version from BitBucket: 'fobi.contrib.plugins.form_elements.content.content_text', 'fobi.contrib.plugins.form_elements.content.content_video', - # `django-fobo` form handlers + # `django-fobi` form handlers 'fobi.contrib.plugins.form_handlers.db_store', 'fobi.contrib.plugins.form_handlers.http_repost', 'fobi.contrib.plugins.form_handlers.mail', From 3daf342cbdb433d83f0c33378b53b425a8d0889f Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Tue, 30 May 2017 21:41:39 +0200 Subject: [PATCH 2/4] more on docs --- .gitignore | 1 + README.rst | 28 + docs/changelog.rst | 1367 ++++++ docs/documentation.rst.distrib | 2 + docs/empty.rst.distrib | 2 + ...obi.contrib.apps.djangocms_integration.rst | 8 + ...orm_elements.content.content_image_url.rst | 38 + ...ion.form_elements.content.content_text.rst | 38 + ...on.form_elements.content.content_video.rst | 38 + ....drf_integration.form_elements.content.rst | 3 + ...on.form_elements.fields.date_drop_down.rst | 38 + ...s.drf_integration.form_elements.fields.rst | 2 + ...s.fields.select_multiple_model_objects.rst | 38 + docs/fobi.contrib.apps.drf_integration.rst | 16 +- ...orm_elements.content.content_image_url.rst | 70 + ....contrib.plugins.form_elements.content.rst | 1 + docs/fobi.migrations.rst | 8 + docs/index.rst | 4035 ++++++++++++++++- docs/licenses.rst | 182 + docs/screenshots.rst.distrib | 4 +- docs/submodules.rst.distrib | 4 + scripts/build_docs.sh | 280 +- scripts/rebuild_docs.sh | 4 +- .../drf_integration/form_elements/README.rst | 2 + .../form_elements/content/README.rst | 3 + .../content/content_image/README.rst | 8 +- .../content/content_image_url/README.rst | 8 +- .../content/content_text/README.rst | 8 +- .../content/content_video/README.rst | 8 +- .../form_elements/fields/README.rst | 3 + .../drf_integration/form_handlers/README.rst | 3 + .../form_handlers/db_store/README.rst | 4 +- .../form_handlers/http_repost/README.rst | 4 +- .../form_handlers/mail/README.rst | 4 +- 34 files changed, 6225 insertions(+), 37 deletions(-) create mode 100644 docs/changelog.rst create mode 100644 docs/empty.rst.distrib create mode 100644 docs/fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.rst create mode 100644 docs/fobi.contrib.apps.drf_integration.form_elements.content.content_text.rst create mode 100644 docs/fobi.contrib.apps.drf_integration.form_elements.content.content_video.rst create mode 100644 docs/fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.rst create mode 100644 docs/fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.rst create mode 100644 docs/fobi.contrib.plugins.form_elements.content.content_image_url.rst create mode 100644 docs/licenses.rst create mode 100644 docs/submodules.rst.distrib create mode 100644 src/fobi/contrib/apps/drf_integration/form_elements/README.rst create mode 100644 src/fobi/contrib/apps/drf_integration/form_elements/content/README.rst create mode 100644 src/fobi/contrib/apps/drf_integration/form_elements/fields/README.rst create mode 100644 src/fobi/contrib/apps/drf_integration/form_handlers/README.rst diff --git a/.gitignore b/.gitignore index c0295321..2f99bed1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ ghostdriver.log /dev.db /.cache/ /htmlcov/ +/third_party/ *.py,cover /.idea/ codebin.py diff --git a/README.rst b/README.rst index 669db9d9..7097a9c8 100644 --- a/README.rst +++ b/README.rst @@ -2322,6 +2322,34 @@ PhantomJS. If you want to use Firefox for testing, remove or comment-out the ``PHANTOM_JS_EXECUTABLE_PATH`` setting. +Writing documentation +===================== +Keep the following hierarchy. + +.. code-block:: text + + ===== + title + ===== + + header + ====== + + sub-header + ---------- + + sub-sub-header + ~~~~~~~~~~~~~~ + + sub-sub-sub-header + ################## + + sub-sub-sub-sub-header + ^^^^^^^^^^^^^^^^^^^^^^ + + sub-sub-sub-sub-sub-header + ++++++++++++++++++++++++++ + Troubleshooting =============== If you get a ``FormElementPluginDoesNotExist`` or a diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 00000000..ae236e9c --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,1367 @@ +Release history and notes +========================= +`Sequence based identifiers +`_ +are used for versioning (schema follows below): + +.. code-block:: text + + major.minor[.revision] + +- It's always safe to upgrade within the same minor version (for example, from + 0.3 to 0.3.4). +- Minor version changes might be backwards incompatible. Read the + release notes carefully before upgrading (for example, when upgrading from + 0.3.4 to 0.4). +- All backwards incompatible changes are mentioned in this document. + +0.11.11 +------- +2017-05-29 + +- Minor fixes in ``content_text`` ``drf_integration`` plugin. +- Added ``imageurl`` support to the ``mailchimp_impoter`` plugin. + +0.11.10 +------- +2017-05-26 + +- Minor fixes in form-wizards on Django 1.11. + +0.11.9 +------ +2017-05-24 + +- Mezzanine integration updated to work with Mezzanine 4.2.3. +- Fixes in date-drop-down plugin when using form wizards. + +0.11.8 +------ +2017-05-17 + +- ``ContentImageURL`` plugin added. +- Minor Python3 fixes in ``db_store`` plugin (related to export of forms to + ``xls`` format). + +0.11.7 +------ +2017-05-16 + +- Fixed in ``fobi.integration`` package related to Django 1.10 and higher. +- FeinCMS integration updated (only migrations added) to work with + FeinCMS 1.13.2. +- DjangoCMS integration updated to work with DjangoCMS 3.4.3. + +0.11.6 +------ +2017-05-15 + +- Minor fixes in ``drf_integration`` app, added GET/detail actions tests. + +0.11.5 +------ +2017-05-15 + +- Added ``date_drop_down`` to ``drf_integration`` app. +- Fixed dependencies issue. +- Added dedicated requirements for specific Django versions. + +0.11.4 +------ +2017-05-12 + +- Minor fixes in integration callbacks of the ``drf_integration`` sub-package. +- Added support for ``content_image``, ``content_text`` and ``content_video`` + plugins. +- Fixes in installable demo. + +0.11.3 +------ +2017-05-10 + +- Concept of integration callbacks introduced and implemented for the + ``drf_integration`` sub-package. + +0.11.2 +------ +2017-05-09 + +- Minor fixes in ``drf_integration`` app. + +0.11.1 +------ +2017-05-08 + +- Minor fixes in ``decimal`` plugin. +- Minor documentation improvements. + +0.11 +---- +2017-05-07 + +This release is dedicated to my beloved `wife `_ +for all the love and support she gave me through years. If you are a company +looking for (female) developers in Groningen area (the Netherlands), do not +hesitate to `contact her `_. + +- Django REST framework integration. Check the Heroku demo `here + `_. +- Documentation fixes. +- PEP8 code fixes. +- Minor setup fixes related to moved screen-shots file. +- Added helper scripts to test with Firefox in headless mode. Describe + testing with Firefox in headless mode in documentation. +- Validate the ``decimal`` field plugin - quantize the decimal value to the + configured precision. +- Minor fixes in the ``float`` field plugin. +- Minor improvements in complex form element plugins (``select``, ``file``) and + form handler plugins (``db_store``, ``mail``, ``http_respost``) in order to + simplify integration plugins and reduce code duplication. +- Minor Python3 fixes in ``range_select`` and ``slider`` form element plugins. +- Minor Python3 fixes in ``http_repost`` and ``mail`` form handler plugins. + +0.10.7 +------ +2017-03-13 + +- Several Django deprecation/moves fixes for better future compatibility. + +0.10.6 +------ +2017-02-14 + +- Minor Python 3 fixes for integer, float and decimal fields. + +0.10.5 +------ +2017-02-13 + +- Tested against Python 3.6. +- Initial (experimental) Django 1.11 support. + +0.10.4 +------ +2017-01-11 + +- Minor fixes in Django admin. +- Various pep8 fixes. +- Fixes additions and improvements in/of docs. +- Add options to test with PhantomJS instead of Firefox. + +0.10.3 +------ +2016-11-24 + +- Minor fixes. + +0.10.2 +------ +2016-11-24 + +- Minor fixes. + +0.10.1 +------ +2016-11-17 + +- Fixed captcha and re-captcha issues in form wizards. + +0.10 +---- +2016-11-16 + +Note, that this release contains minor backwards incompatible changes, that may +break your code. Two additional arguments have been added to the +`submit_plugin_form_data` method of the form element plugins. If you have +written custom form element plugins - update your code. + +- Added `form_entry_elements` and `kwargs` to the `submit_plugin_form_data` + method of the form element plugins. Make sure to update your custom + plugins if you have written any. +- Added tests for mailchimp integration plugin. +- Moving all plugins to base submodules of the correspondent sub + packages. +- Add missing whitespace to the ``help_text`` of the ``title`` field of + ``FormEntry`` and ``FormWizardEntry`` models. +- Disable GoogleAnalytics while testing (guess what - this change speeds up + selenium tests twice). +- Docs updated. +- Helper scripts updated. +- Multiple pep8 fixes. + +0.9.17 +------ +2016-11-13 + +Announcing dropping support of Python 2.6 and Django 1.7. As of 0.9.17 +everything is still backwards compatible with Django 1.7, but in future +versions it will be wiped out. + +- Value validations for Integer and Text Fields. +- Hide previous button in form wizard template for bootstrap3 on first step. + +0.9.16 +------ +2016-11-10 + +- Introduced form titles (shown in view templates). +- Improved navigation of the form wizards. + +0.9.15 +------ +2016-11-07 + +- Minor fixes. + +0.9.14 +------ +2016-11-07 + +- Minor fixes. + +0.9.13 +------ +2016-11-05 + +Announcing dropping support of Django 1.5 and 1.6. As of 0.9.17 everything is +still backwards compatible with versions 1.5 and 1.6, but in future versions +compatibility with these versions will be wiped out. + +- Fix backwards compatibility of `slider` and `range_select` plugins with + Django versions 1.5 and 1.6. + +0.9.12 +------ +2016-11-02 + +- Better debugging. +- Upgrade example FeinCMS integration to work with 1.12. + +0.9.11 +------ +2016-11-01 + +- Fixes. + +0.9.10 +------ +2016-11-01 + +- Fixed issue with custom labels in the `slider` plugin. +- Made `slider` plugin compatible with Django <= 1.6. +- Fixes `get_absolute_url` methods on `FormEntry` and `FormWizardEntry` + models. #48 + +0.9.9 +----- +2016-10-31 + +- Make it possible to add custom ticks to the `slider` plugin. + +0.9.8 +----- +2016-10-27 + +- Support multiple sliders in one form. + +0.9.7 +----- +2016-10-27 + +- Improvements in the generic integration processor. #47 +- Improved form wizard interface and navigation. +- Fixed a broken test. +- Added import/export functionality for form wizards. + +0.9.6 +----- +2016-10-25 + +- Fixed InvalidQuery exception raised when attempting to export entry from a + 'DB store' handler. #44 +- Fixed ProgrammingError raised when using the 'Export data to CSV/XLS' + action. #45 + +0.9.5 +----- +2016-10-25 + +- Minor fixes in `slider` and `select_range` plugins. + +0.9.4 +----- +2016-10-24 + +- Fix issue with `select_multiple`, `select_multiple_model_objects` and + `select_multiple_mptt_model_objects` being invalidated on the last step + of the form wizard. + +0.9.3 +----- +2016-10-24 + +- Change to `NumberInput` widget for all number inputs. +- Fixed issue with `slider` plugin missing labels if `Show endpoints as` is + set to `Labeled ticks`. +- Link to edit form entry added to edit form wizard entry view. + +0.9.2 +----- +2016-10-24 + +- Minor fixes. + +0.9.1 +----- +2016-10-24 + +- Minor fixes. + +0.9 +--- +2016-10-24 + +Note, that this release contain minor backwards incompatible changes, that +may break your existing code (your data is left intact). If you have written +custom form element plugins you should update your code! + +- The :method:`get_form_field_instances` + and :method:`_get_form_field_instances` of + the :class:`fobi.base.FormElementPlugin` both accept two new optional + arguments: `form_entry` and `form_element_entries` as well as **kwargs. + Make sure to update your custom plugins if you have written any. +- Minor fixes in the form wizards: forms in intermediate steps do receive + updates from the `submit_plugin_form_data` of the plugins. +- Fixed issue in the `base_bulk_change_plugins` function on Django 1.10. + +0.8.10 +------ +2016-10-22 + +- Minor CSS improvements of the `slider` plugin. +- Fixed broken readthedocs requirements. + +0.8.9 +----- +2016-10-22 + +- Simplified debugging (never set `FOBI_DEBUG` to True in production!). +- Major `slider` plugin improvements. + +0.8.8 +----- +2016-10-21 + +- Minor `slider` plugin improvements (JavaScript). + +0.8.7 +----- +2016-10-21 + +- Fixed issue of plugin media not being collected in the form wizard. + +0.8.6 +----- +2016-10-21 + +- Functional improvements of `slider` plugin. + +0.8.5 +----- +2016-10-20 + +- Add `range_select` and `slider` form field plugins. +- Fixed custom CSS classes not appearing in the rendered HTML of the field + plugin/widget. +- Fixed issue with undefined file storage for form wizards. From now on + the `FileSystemStorage` storage is used for wizard uploads. +- Fixed too much of extreme data view/export security of the `db_store` + plugin. +- Backwards compatibility fixes for Django < 1.7. + +0.8.4 +----- +2016-10-19 + +- Fix broken export (to JSON) of form entries. +- Fix broken import (from JSON) of form entries. + +0.8.3 +----- +2016-10-18 + +- Minor fixes. + +0.8.2 +----- +2016-10-18 + +- Minor fixes. + +0.8.1 +----- +2016-10-17 + +- Minor fixes. + +0.8 +--- +2016-10-17 + +Release supported by `Lund University Cognitive Science +`_. + +- Adding form-wizards functionality. Note, that at the moment only + `bootstrap3` theme was updated to filly support the form wizards. Although, + all other themes would by default support form-wizard functionality, they + may not look as nice as they should be (to be fixed in 0.8.x releases + shortly). +- The `six` package requirements increased to >= 1.8. +- Tests comply with pep8. +- Fixed recently broken drag-and-drop ordering of the form elements. +- Fixed typo for HTML id "tab-form-elemenets" -> "tab-form-elements". You + may need to update your custom CSS/JS/HTML accordingly. See the listing + 0.8.a for the files affected. +- An additional property `form_view_form_entry_option_class` has been added + to all the themes. Change your custom CSS/jS/HTML accordingly. See the + listing 0.8.b for the files affected. +- Fixed drag-and-drop not working for ordering of form elements. #43 +- Fixed issue with non-proper rendering of the form-importer templates. + +Although this release does not contain backwards incompatible changes, there +have been several changes in GUI and some parts of the generic HTML and themes +were updated. If you have custom themes implemented, you should likely make +some minor updates to the HTML in order to reflect the latest GUI changes. +The following templates have been affected: + +New files +~~~~~~~~~ +- src/fobi/contrib/plugins/form_handlers/db_store/templates/db_store/view_saved_form_wizard_data_entries.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/add_form_wizard_handler_entry.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/add_form_wizard_handler_entry_ajax.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/create_form_wizard_entry.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/create_form_wizard_entry_ajax.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/edit_form_wizard_entry.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/edit_form_wizard_entry_ajax.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/form_wizards_dashboard.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/snippets/form_wizard_ajax.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/snippets/form_wizard_properties_snippet.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/snippets/form_wizard_snippet.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/view_form_wizard_entry.html +- src/fobi/contrib/themes/bootstrap3/templates/bootstrap3/view_form_wizard_entry_ajax.html +- src/fobi/templates/fobi/generic/add_form_wizard_handler_entry.html +- src/fobi/templates/fobi/generic/add_form_wizard_handler_entry_ajax.html +- src/fobi/templates/fobi/generic/create_form_wizard_entry.html +- src/fobi/templates/fobi/generic/create_form_wizard_entry_ajax.html +- src/fobi/templates/fobi/generic/edit_form_wizard_entry.html +- src/fobi/templates/fobi/generic/edit_form_wizard_entry_ajax.html +- src/fobi/templates/fobi/generic/form_wizard_entry_submitted.html +- src/fobi/templates/fobi/generic/form_wizard_entry_submitted_ajax.html +- src/fobi/templates/fobi/generic/form_wizards_dashboard.html +- src/fobi/templates/fobi/generic/snippets/form_wizard_ajax.html +- src/fobi/templates/fobi/generic/snippets/form_wizard_properties_snippet.html +- src/fobi/templates/fobi/generic/snippets/form_wizard_snippet.html +- src/fobi/templates/fobi/generic/snippets/form_wizard_view_ajax.html +- src/fobi/templates/fobi/generic/view_form_wizard_entry.html +- src/fobi/templates/fobi/generic/view_form_wizard_entry_ajax.html + +Existing files +~~~~~~~~~~~~~~ +- src/fobi/contrib/plugins/form_importers/mailchimp_importer/templates/mailchimp_importer/1.html +- src/fobi/contrib/plugins/form_importers/mailchimp_importer/views.py +- src/fobi/contrib/themes/djangocms_admin_style_theme/templates/djangocms_admin_style_theme/edit_form_entry_ajax.html +- src/fobi/contrib/themes/foundation5/templates/foundation5/edit_form_entry_ajax.html +- src/fobi/templates/fobi/generic/edit_form_entry_ajax.html + +Additional listings +~~~~~~~~~~~~~~~~~~~ +Listing 0.8.a "tab-form-elemenets" -> "tab-form-elements" +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- src/fobi/contrib/themes/djangocms_admin_style_theme/static/djangocms_admin_style_theme/css/fobi.djangocms_admin_style_theme.edit.css +- src/fobi/contrib/themes/djangocms_admin_style_theme/templates/djangocms_admin_style_theme/edit_form_entry_ajax.html +- src/fobi/contrib/themes/foundation5/templates/foundation5/edit_form_entry_ajax.html +- src/fobi/contrib/themes/simple/static/simple/css/fobi.simple.edit.css +- src/fobi/contrib/themes/simple/templates/simple/edit_form_entry_ajax.html +- src/fobi/templates/fobi/generic/edit_form_entry_ajax.html +- src/fobi/templates/fobi/generic/edit_form_wizard_entry_ajax.html + +Listing 0.8.b `form_view_form_entry_option_class` property +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- src/fobi/contrib/themes/bootstrap3/fobi_themes.py +- src/fobi/contrib/themes/djangocms_admin_style_theme/fobi_themes.py +- src/fobi/contrib/themes/foundation5/fobi_themes.py +- src/fobi/contrib/themes/simple/fobi_themes.py +- src/fobi/templates/fobi/generic/edit_form_wizard_entry_ajax.html + +0.7.1 +----- +2016-09-22 + +Release sponsored by `Goldmund, Wyldebeast & Wunderliebe +`_. + +- Code comply with pep8. +- Minor fixes in selenium tests. + +0.7 +--- +2016-09-13 + +Release sponsored by `Goldmund, Wyldebeast & Wunderliebe +`_. + +- Initial Django 1.10 support. +- `django-localeurl` has been replaced with `i18n_patterns` in sample project. +- Minor fixes. + +0.6.10 +------ +2016-09-11 + +- Moved `plugin_uid` field choices from model level to form level for + `FormHandler` and `FormHandlerEntry` models. #37 + +0.6.9 +----- +2016-09-08 + +- Moved `plugin_uid` field choices from model level to form level for + `FormElement` and `FormElementEntry` models. #37 +- Fixed element "name" field stripping underscores issue. #33 + +0.6.8 +----- +2016-09-06 + +- Fixed changing order of the `FormElement`, `FormElementEntry`, `FormHandler` + and `FormHandlerEntry` models. + +0.6.7 +----- +2016-08-30 + +- Minor fixes in `db_store` plugin (Django 1.6 compatibility issue). +- Added __str__ methods to models. +- Restrict queryset to form element entries related to the form entry in + position calculation. + +0.6.6 +----- +2016-05-12 + +- Fixed broken dependencies in demos. +- Minor fixes. +- Adding a new `Select multiple with max` plugin, which restricts max number + of choices allowed to be chosen. + +0.6.5 +----- +2015-12-24 + +- Minor fixes. + +0.6.4 +----- +2015-12-24 + +- Minor fixes. + +0.6.3 +----- +2015-12-23 + +- Minor fixes. + +0.6.2 +----- +2015-12-22 + +- Make it possible to render a list of forms using custom template tag (not + only on the dashboard page). + +0.6.1 +----- +2015-12-21 + +- Documentation fixes. + +0.6 +--- +2015-12-18 + +- Form importers (and as a part of it - MailChimp integration, + which would allow to import forms from MailChimp into `django-fobi` using + a user-friendly wizard). +- Improved Django 1.9 support. + +0.5.19 +------ +2015-12-15 + +- New style urls everywhere. + +0.5.18 +------ +2015-12-08 + +- Minor improvements. Adding request to the `get_form_field_instances` method + of the `FormElementPlugin`. + +0.5.17 +------ +2015-10-22 + +- Increased `easy-thumbnails` requirement to >= 2.1 for Python 3, since it was + causing installation errors. +- Increased the `django-nine` requirement to >=0.1.6, since it has better + Python 3 support. + +0.5.16 +------ +2015-10-05 + +- Fixes in migrations on Django 1.7. + +0.5.15 +------ +2015-09-17 + +- Minor fixes. + +0.5.14 +------ +2015-09-13 + +- Add create/update dates to the forms. Adding initial migrations. + +0.5.13 +------ +2015-09-01 + +- Translation fixes. +- Updating Dutch and Russian translations. + +0.5.12 +------ +2015-08-29 + +- Export/import forms into/from JSON. +- Minor UI improvements. Adding "Service" tab in the edit view which contains + links to export form to JSON and delete form. + +Although this release does not contain backwards incompatible changes, there +have been several changes in GUI and some parts of the generic HTML and themes +were updated. If you have custom themes implemented, you should likely make +some minor updates to the HTML in order to reflect the latest GUI changes. +The following templates have been affected: + +New files +~~~~~~~~~ +- src/fobi/contrib/themes/djangocms_admin_style_theme/templates/djangocms_admin_style_theme/import_form_entry.html +- src/fobi/contrib/themes/djangocms_admin_style_theme/templates/djangocms_admin_style_theme/import_form_entry_ajax.html + +- src/fobi/contrib/themes/foundation5/templates/foundation5/import_form_entry.html +- src/fobi/contrib/themes/foundation5/templates/foundation5/import_form_entry_ajax.html + +- src/fobi/contrib/themes/simple/templates/simple/import_form_entry.html +- src/fobi/contrib/themes/simple/templates/simple/import_form_entry_ajax.html + +- src/fobi/templates/fobi/generic/import_form_entry.html +- src/fobi/templates/fobi/generic/import_form_entry_ajax.html + +Existing files +~~~~~~~~~~~~~~ +- src/fobi/contrib/themes/djangocms_admin_style_theme/templates/djangocms_admin_style_theme/dashboard.html +- src/fobi/contrib/themes/djangocms_admin_style_theme/templates/djangocms_admin_style_theme/edit_form_entry_ajax.html + +- src/fobi/contrib/themes/foundation5/templates/foundation5/dashboard.html +- src/fobi/contrib/themes/foundation5/templates/foundation5/edit_form_entry_ajax.html + +- src/fobi/contrib/themes/simple/templates/simple/dashboard.html +- src/fobi/contrib/themes/simple/templates/simple/edit_form_entry_ajax.html + +- src/fobi/templates/fobi/generic/dashboard.html +- src/fobi/templates/fobi/generic/edit_form_entry_ajax.html + +0.5.11 +------ +2015-08-20 + +- Minor improvements of the dynamic values feature. Forbid usage of django + template tags in initial values. + +0.5.10 +------ +2015-08-18 + +- Minor improvements of the initial dynamic values feature. + +0.5.9 +----- +2015-08-17 + +- Minor fixes in the initial dynamic values feature. + +0.5.8 +----- +2015-08-16 + +- Made it possible to define dynamic initials for form fields. Example initial + dynamic values in the form (like {{ request.path }}). +- Minor fixes/improvements. + +0.5.7 +----- +2015-08-03 + +- Minor Python 3 improvements. + +0.5.6 +----- +2015-07-31 + +- `django-mptt` support through `select_mptt_model_object` and + `select_multiple_mptt_model_objects` plugins. +- Python 3 fixes. + +0.5.5 +----- +2015-06-30 + +- Change the `action` field of the FormEntry into a URL field; check if + action exists. +- `captcha`, `recaptcha` and `honeypot` plugins have been made required + in the form. +- Fix: take default values provided in the `plugin_data_fields` of the plugin + form into consideration. + +0.5.4 +----- +2015-05-21 + +- Minor Django 1.8 fixes. +- Improved texts/translations. + +0.5.3 +----- +2015-05-02 + +- Minor fixes in the `mail + `_ + form handler plugin. + +0.5.2 +----- +2015-04-26 + +- Make it possible to provide multiple `to` email addresses in the `mail + `_ + form handler plugin. +- DateTime picker widget added for Foundation5 theme for `date + `_ + and `datetime + `_ + plugins. +- Added more tests (more plugins tested). + +0.5.1 +----- +2015-04-21 + +- DateTime picker widget added for Bootstrap 3 theme for `date + `_ + and `datetime + `_ + plugins. + +0.5 +--- +2015-04-06 + +Note, that this release contains minor backwards incompatible changes. The +changes may affect your existing forms and data. Read the notes below +carefully. + +- Fixed previously wrongly labeled (in `AppConf`) add-ons/plugins + (`fobi.contrib.plugins.form_handlers.db_store`, + `fobi.contrib.apps.feincms_integration`, + `fobi.contrib.apps.djangocms_integration`, + `fobi.contrib.apps.mezzanine_integration`). Due to the change, you would + likely have to to rename a couple of database tables and update referencies + accordingly. No migrations to solve the issue are included at the moment. + +0.4.36 +------ +2015-04-03 + +- Handle non-ASCII characters content_text form element. + +0.4.35 +------ +2015-03-28 + +- Fixed the issue with `allow_multiple` working incorrectly for form handler + plugins. Fix the `db_store` plugin as well. + +0.4.34 +------ +2015-03-27 + +- Minor fixes in the `Checkbox select multiple` and `Radio` plugins. +- Minified tox tests. + +0.4.33 +------ +2015-03-26 + +- `Checkbox select multiple + `_ + field added. +- Minor improvements (styling) in the Foundation 5 theme. +- Initial configuration for tox tests. +- Clean up requirements (for example setups and tests). + +0.4.32 +------ +2015-03-25 + +- Updated missing parts in the Russian translations. +- Minor API improvements. From now on, the `run` method of form handlers + may return a tuple (bool, mixed). In case of errors it might be (False, err). +- Minor code clean ups. + +0.4.31 +------ +2015-03-23 + +- When path of the uploaded file (plugins) doesn't yet exist, create it, + instaid of failing. + +0.4.30 +------ +2015-03-23 + +- From now on submitted files are sent as attachments in the mail plugin. +- Documentation improvements. Adding information of rendering forms using + `django-crispy-forms` or alternatives. +- Minor fixes. + +0.4.29 +------ +2015-03-20 + +- `Decimal + `_ + field added. +- `Float + `_ + field added. +- `Slug + `_ + field added. +- `IP address + `_ + field added. +- `Null boolean + `_ + field added. +- `Time + `_ + field added. +- From now on using `simplejson` package in favour of `json`, since it can + handle decimal data. +- Minor improvements of the date plugins (`datetime`, `date`). + +0.4.28 +------ +2015-03-13 + +- Fix improperly picked configurations of the + `fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects` + plugin. +- Long identifiers of models can now be safely used in foreign key plugins + (such as + `fobi.contrib.plugins.form_elements.fields.select_model_object_plugin` and + `fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects` + plugins). +- Fixed admin bulk change of the plugins. +- From now it's possible to have some control/configure the following plugins + for the submitted value: + + * fobi.contrib.plugins.form_elements.fields.select_model_object + * fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects + + The only thing needs to be done is to specify the appropriate variable + in the settings module of the project (settings.py). + + * FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_SUBMIT_VALUE_AS + * FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MODEL_OBJECTS_SUBMIT_VALUE_AS + + Allowed values are: "val", "repr", "mix". + +0.4.27 +------ +2015-03-12 + +- Temporary allow the `fobi.contrib.plugins.form_handlers.db_store` plugin to + be used multiple times per form, until the bug with not being able to assign + the `db_store` plugin to the form due to incorrect handling of restrictions + (``allow_multiple``) introduced in previous version is properly fixed. +- From now it's possible to have some control/configure the following plugins + for the submitted value: + + * fobi.contrib.plugins.form_elements.fields.radio + * fobi.contrib.plugins.form_elements.fields.select + * fobi.contrib.plugins.form_elements.fields.select_multiple + + The only thing needs to be done is to specify the appropriate variable + in the settings module of the project (settings.py). + + * FOBI_FORM_ELEMENT_RADIO_SUBMIT_VALUE_AS + * FOBI_FORM_ELEMENT_SELECT_SUBMIT_VALUE_AS + * FOBI_FORM_ELEMENT_SELECT_MULTIPLE_SUBMIT_VALUE_AS + + Allowed values are: "val", "repr", "mix". + +0.4.26 +------ +2015-03-06 + +- Validate `fobi.contrib.plugins.form_elements.fields.email`, + `fobi.contrib.plugins.form_elements.fields.integer` and + `fobi.contrib.plugins.form_elements.fields.url` plugins initial values. +- Properly show field types "checkbox" and "radio" in the `input` plugin (as + previously they showed up too large). +- It's now possible to restrict multiple usage of form handler plugins via + ``allow_multiple`` property. In case if it's set to False, the plugin can + be used once only (per form). Default value is True. The `db_store` plugin + is from now on allowed to be used only once (per form). + +0.4.25 +------ +2015-03-04 + +- Post-fix in the discover module (moved logging definition up). + +0.4.24 +------ +2015-03-04 + +- The management command `migrate_03_to_04` intended to migrate 0.3.x branch + data to > 0.4.x branch data, has been renamed to `fobi_migrate_03_to_04`. +- Add missing app config declaration for the `db_store` form handler plugin. +- Add missing app config for the core `fobi` package. +- Improved autodiscover for Django>=1.7. Fix exception when using a dotted + path to an `AppConfig` in `INSTALLED_APPS` (instead of using the path to + the app: ex. "path.to.app.apps.AppConfig" instead of "path.to.app"). + +0.4.23 +------ +2015-03-04 + +- Fix improper initial value validation for Select-like (`radio`, `select` and + `select_multiple`) plugins. + +0.4.22 +------ +2015-03-03 + +- Fix replace system-specific path separator by a slash on file urls. +- Fix empty options appearing in the Select-like (`radio`, `select` and + `select_multiple`) plugins and unified the processing of the raw choices + data. +- Validate the initial value for Select-like (`radio`, `select` and + `select_multiple`) plugins. + +0.4.21 +------ +2015-02-28 + +- The + ``fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects`` + plugin added. + +0.4.20 +------ +2015-02-27 + +- Make it possible to load initial form data from GET variables. +- Remove "button" and "submit" types from ``fobi.contrib.elements.fields.input`` + form element plugin. +- The ``fobi.contrib.plugins.form_elements.fields.select_model_object`` plugin + no longer returns an absolute URL to the admin of the chosen model object + instance. Instead, it contains the app label, model name, pk and the repr + of it separated by dots. Example: "comments.comment.5.Lorem ipsum". +- Minor fixes in ``from fobi.contrib.elements.fields.file`` plugin. Use system + path separator on ``from fobi.contrib.elements.fields.file.FILES_UPLOAD_DIR`` + default setting. +- Minor documentation improvements. + +0.4.19 +------ +2015-02-15 + +- Some more work on future (Django 1.9) compatibility. +- Replace bits of backwards-/forwards- compatibility code with equal code + parts of ``django-nine``. + +0.4.18 +------ +2015-02-13 + +- From now on it's possible to localise (translated) URLs. +- Safe way to get the user model for Django >= 1.5.* <= 1.8.* + +0.4.17 +------ +2015-02-12 + +- Fix circular imports by proper referencing of the user model in + foreign key and many-to-many relations (``settings.AUTH_USER_MODEL`` instead + of ``django.contrib.auth.get_user_model``). +- Minor documentation improvements. + +0.4.16 +------ +2015-02-10 + +- A new theme ``djangocms_admin_style_theme`` added. +- Making ``fobi.fields.NoneField`` always valid. +- Initial work on Django 1.8 and 1.9 support. +- Minor fixes. + +0.4.15 +------ +2015-01-27 + +- Fix the "large" checkboxes in edit mode - now shown small as they should be. + +0.4.14 +------ +2015-01-26 + +- German translations added. + +0.4.13 +------ +2015-01-15 + +- Remove an `ipdb` statement from base integration processor + `fobi.integration.processors.IntegrationProcessor`. +- Added information in the docs about FeinCMS demo part on heroku demo. +- Make sure values of form elements declared not to have a value (``has_value`` + property is set to False) aren't being saved in the ``db_store`` plugin. +- Remove redundant static assets (package size decreased). + +0.4.12 +------ +2015-01-14 + +- Fix empty options appearing in the Select-like plugins and unified the + processing of the raw choices data. +- Update the `vishap` package requirement to latest stable 0.1.3. +- Support for wheel packages. + +0.4.11 +------ +2014-12-29 + +- Styling fixes in the ``radio`` button field of the ``bootstrap3`` theme. +- Fixed ``db_store`` issue with CSV/XLS export failing on Django 1.7. + +0.4.10 +------ +2014-12-28 + +- Minor fixes in FeinCMS integration app. + +0.4.9 +----- +2014-12-28 + +- Third party app integration (at the moment, FeinCMS, DjangoCMS, Mezzanine) + had been generalised and unified. +- Mention the Heroku live demo in the docs. +- Minor CSS fixes in the ``simple`` theme. + +0.4.8 +----- +2014-12-25 + +- More verbose debugging. + +0.4.7 +----- +2014-12-24 + +- Temporary left out the "cloneable" column from the dashboard templates. +- Fixed broken imports in CAPTCHA plugin. +- Fixed broken imports in ReCAPTCHA plugin. + +0.4.6 +----- +2014-12-23 + +- Updated requirements for the ``vishap`` package to avoid the ``six`` version + conflicts. +- Minor documentation fixes. + +0.4.5 +----- +2014-12-17 + +- ReCAPTCHA field added. +- Mezzanine integration app added. +- Remove redundant dependencies (django-tinymce). +- Minor improvements of the discover module. + +0.4.4 +----- +2014-12-06 + +- Documentation improvements. +- Updated Dutch and Russian translations. +- Minor fixes related to lazy translations. + +0.4.3 +----- +2014-12-05 + +- Make sure values of form elements declared not to have a value (``has_value`` + property is set to False) aren't being saved in the ``db_store`` plugin. +- Apply that to the ``honeypot`` and ``captcha`` plugins. + +0.4.2 +----- +2014-12-04 + +- Helper script (management command) in order to migrate django-fobi==0.3.* + data to django-fobi==0.4.* data (caused by renaming the ``birthday`` field + to ``date_drop_down`` - see the release notes of 0.4 below). Follow the steps + precisely in order to painlessly upgrade your django-fobi==0.3.* to + django-fobi==0.4.*: + + 1. Install django-fobi>=0.4.2:: + + pip install django-fobi>=0.4.2 + + 2. In your settings change the:: + + 'fobi.contrib.plugins.form_elements.fields.birthday' + + to:: + + 'fobi.contrib.plugins.form_elements.fields.date_drop_down' + + 3. Run the ``migrate_03_to_04`` management command. Note, that as of version + 0.4.24, the `migrate_03_to_04` command has been renamed to + `fobi_migrate_03_to_04`.:: + + ./manage.py migrate_03_to_04 + +0.4.1 +----- +2014-12-04 + +- Fixes in Foundation5 and Simple themes related to the changes in error + validation/handling of hidden fields. + +0.4 +--- +2014-12-03 + +Note, that this release contains minor backwards incompatible changes. The +changes may affect your existing forms and data. Read the notes below +carefully (UPDATE 2014-12-04: the django-fobi==0.4.2 contains a management +command which makes the necessary changes in the database for safe upgrade). + +- The ``captcha`` field has been moved from + ``fobi.contrib.plugins.form_elements.fields.captcha`` to + ``fobi.contrib.plugins.form_elements.security.captcha``. Make sure to update + the package paths in ``INSTALLED_APPS`` of your projects' settings module + (settings.py) when upgrading to this version. +- The ``honeypot`` field has been added. +- The ``birthday`` field has been renamed to ``date_drop_down`` (A real + ``birthday`` field is still to come in later releases). The change causes + backwards incompatibility issues if you have used that ``birthday`` field. + If you haven't - you have nothing to worry. If you have been using it, + grab the 0.3.4 version, copy the + ``fobi.contrib.plugins.form_elements.fields.date_drop_down`` package to + your project apps, make necessary path changes and update the package paths + in ``INSTALLED_APPS`` settings module (settings.py) before upgrading to this + version. Then, in Django admin management interface, replace all the + occurances of ``Birthday`` field with ``Date drop down`` field. +- Better error validation/handling of hidden fields. A new form snippet + template added for displaying the non-field and hidden fields errors. The new + template makes a part of a standard theme as an attribute + ``form_non_field_and_hidden_errors_snippet_template``. +- Minor fixes in generic templates. +- An additional property ``is_hidden`` added to the hidden form elements. Those + form elements would be getting a default TextInput widget in the edit mode + instead of the widget they come from by default. It's possible to provide an + alternative widget for the edit mode as well. Default value of the + ``is_hidden`` is set to False. + +0.3.4 +----- +2014-11-23 + +- New settings ``FOBI_FAIL_ON_ERRORS_IN_FORM_ELEMENT_PLUGINS`` and + ``FOBI_FAIL_ON_ERRORS_IN_FORM_HANDLER_PLUGINS`` introduced. They do as + their name tells. Default value for both is False. +- Fixed exceptions raised when unicode characters were used as form names. +- Fixed exceptions raised when unicode characters were used as field labels. +- Fixes in the `db_store` and `mail` plugins related to usage of unicode + characters. + +0.3.3 +----- +2014-11-22 + +- Clean up the setup. Remove redundant dependencies. +- Documentation improvements. + +0.3.2 +----- +2014-11-20 + +- DjangoCMS integration app made compatible with DjangoCMS 2.4.3. + +0.3.1 +----- +2014-11-19 + +- DjangoCMS integration app. + +0.3 +--- +2014-11-09 + +Note, that this release contains minor backwards incompatible changes. The +changes do not anyhow affect your existing forms or data. The only thing you +need to do is update the app paths in the ``settings`` module of your project. + +- Minor core improvements related to the themeing of the form handler plugins. +- Several presentational form element plugins have been renamed. + The ``fobi.contrib.plugins.form_elements.content.image`` plugin has been + renamed to ``fobi.contrib.plugins.form_elements.content.content_image``. + The ``fobi.contrib.plugins.form_elements.content.text`` plugin has been + renamed to ``fobi.contrib.plugins.form_elements.content.content_text``. + The ``fobi.contrib.plugins.form_elements.content.video`` plugin has been + renamed to ``fobi.contrib.plugins.form_elements.content.content_video``. + If you have used any of the above mentioned plugins, make sure to update + the app paths in the ``settings`` module of your project. +- The ``fobi.contrib.plugins.form_elements.content.dummy`` plugin has been moved + to ``fobi.contrib.plugins.form_elements.test.dummy`` location. If you have + used it, make sure to update the its' path in the ``settings`` module of + your project. +- Added readme to the following content form element plugins: ``dummy``, + ``content_image``, ``content_text`` and ``content_video``. +- Added ``foundation5`` and ``simple`` theme widgets for ``db_store`` plugin. +- If you have been overriding the defaults of the ``db_store`` plugin, change + the prefix from ``FOBI_PLUGIN_DB_EXPORT_`` to ``FOBI_PLUGIN_DB_STORE_``. For + example, ``FOBI_PLUGIN_DB_EXPORT_CSV_DELIMITER`` should become + ``FOBI_PLUGIN_DB_STORE_CSV_DELIMITER``. +- Mentioning the ``fobi_find_broken_entries`` management command in the + documentation, as well as improving the management command itself (more + verbose output). +- Birthday field added. + +0.2.1 +----- +2014-11-06 + +- Minor improvements of the ``db_store`` plugin. +- Minor improvements of the ``simple`` theme. Make sure that custom + form handler actions are properly shown in the form handlers list. +- Make it possible to fail silently on missing form element or form + handler plugins by setting the respected values to False: + ``FOBI_FAIL_ON_MISSING_FORM_ELEMENT_PLUGINS``, + ``FOBI_FAIL_ON_MISSING_FORM_HANDLER_PLUGINS``. Otherwise an appropriate + exception is raised. + +0.2 +--- +2014-11-05 + +Note, that this release contains minor backwards incompatible changes. + +- Minor (backwards incompatible) changes in the form handler plugin API. + From now on both ``custom_actions`` and ``get_custom_actions`` methods + accept ``form_entry`` (obligatory) and ``request`` (optional) arguments. If + you have written your own or have changed existing form handler plugins + with use of one of the above mentioned methods, append those arguments to + the method declarations when upgrading to this version. If you haven't + written your own or changed existing form handler plugins, you may just + upgrade to this version. +- Added data export features to the ``db_store`` plugin. +- Minor fixes in ``db_store`` plugin. +- Added missing documentation for the ``feincms_integration`` app. +- Updated translations for Dutch and Russian. + +0.1.6 +----- +2014-10-25 + +- Minor improvements in the theming API. From now on the + ``view_embed_form_entry_ajax_template`` template would be used + when integrating the form rendering from other products (for example, + a CMS page, which has a widget which references the form object. If + that property is left empty, the ``view_form_entry_ajax_template`` + is used. For a success page the ``embed_form_entry_submitted_ajax_template`` + template would be used. +- Functional improvements of the FeinCMS integration (the widget). If you + have used the FeinCMS widget of earlier versions, you likely want to update + to this one. From now on you can select a custom form title and the button + text, as well as provide custom success page title and the success message; + additionally, it has been made possible to hide the form- or success-page- + titles. + +0.1.5 +----- +2014-10-23 + +- Minor fixes in the ``Integer`` form element plugin. +- Minor fixes in the ``Input`` form element plugin. +- Minor fixes in themes (disable HTML5 form validation in edit mode). +- Minor documentation improvements. + +0.1.4 +----- +2014-10-22 + +- Minor core improvements. +- Django 1.5 support improvements. +- Django 1.7 support improvements. +- Added ``Captcha`` form element plugin. +- Added highly-customisable ``Input`` form element plugin - a custom input field + with support for almost any ever existing HTML attribute. +- Documentation improvements. + +0.1.3 +----- +2014-10-13 + +- Django 1.7 support. +- Add HTML5 "placeholder" field attribute support. + +0.1.2 +----- +2014-10-11 + +- Simple theme fixes: Fix for making the theme work in Django 1.5. + +0.1.1 +----- +2014-10-11 + +- Bootstrap 3 theme fixes: When tab pane has no or little content so + that the height of the dropdown menu exceeds the height of the tab pane + content the dropdown menu now becomes scrollable (vertically). + +0.1 +--- +2014-10-11 + +- Initial release. diff --git a/docs/documentation.rst.distrib b/docs/documentation.rst.distrib index 224b9b5e..8115b2ae 100644 --- a/docs/documentation.rst.distrib +++ b/docs/documentation.rst.distrib @@ -8,6 +8,8 @@ Contents: fobi quickstart + changelog + licenses Indices and tables ================== diff --git a/docs/empty.rst.distrib b/docs/empty.rst.distrib new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/docs/empty.rst.distrib @@ -0,0 +1,2 @@ + + diff --git a/docs/fobi.contrib.apps.djangocms_integration.rst b/docs/fobi.contrib.apps.djangocms_integration.rst index b53915a7..2c1a8a88 100644 --- a/docs/fobi.contrib.apps.djangocms_integration.rst +++ b/docs/fobi.contrib.apps.djangocms_integration.rst @@ -20,6 +20,14 @@ fobi.contrib.apps.djangocms_integration.cms_plugins module :undoc-members: :show-inheritance: +fobi.contrib.apps.djangocms_integration.cms_version module +---------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.djangocms_integration.cms_version + :members: + :undoc-members: + :show-inheritance: + fobi.contrib.apps.djangocms_integration.conf module --------------------------------------------------- diff --git a/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.rst b/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.rst new file mode 100644 index 00000000..2317cda9 --- /dev/null +++ b/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.rst @@ -0,0 +1,38 @@ +fobi.contrib.apps.drf_integration.form_elements.content.content_image_url package +================================================================================= + +Submodules +---------- + +fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.apps module +------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.apps + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.base module +------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.base + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.fobi_integration_form_elements module +--------------------------------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_image_url.fobi_integration_form_elements + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_image_url + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_text.rst b/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_text.rst new file mode 100644 index 00000000..328d4426 --- /dev/null +++ b/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_text.rst @@ -0,0 +1,38 @@ +fobi.contrib.apps.drf_integration.form_elements.content.content_text package +============================================================================ + +Submodules +---------- + +fobi.contrib.apps.drf_integration.form_elements.content.content_text.apps module +-------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_text.apps + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.content.content_text.base module +-------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_text.base + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.content.content_text.fobi_integration_form_elements module +---------------------------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_text.fobi_integration_form_elements + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_text + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_video.rst b/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_video.rst new file mode 100644 index 00000000..5faaaeef --- /dev/null +++ b/docs/fobi.contrib.apps.drf_integration.form_elements.content.content_video.rst @@ -0,0 +1,38 @@ +fobi.contrib.apps.drf_integration.form_elements.content.content_video package +============================================================================= + +Submodules +---------- + +fobi.contrib.apps.drf_integration.form_elements.content.content_video.apps module +--------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_video.apps + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.content.content_video.base module +--------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_video.base + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.content.content_video.fobi_integration_form_elements module +----------------------------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_video.fobi_integration_form_elements + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.content.content_video + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/fobi.contrib.apps.drf_integration.form_elements.content.rst b/docs/fobi.contrib.apps.drf_integration.form_elements.content.rst index 92153a1d..289dd4d8 100644 --- a/docs/fobi.contrib.apps.drf_integration.form_elements.content.rst +++ b/docs/fobi.contrib.apps.drf_integration.form_elements.content.rst @@ -7,6 +7,9 @@ Subpackages .. toctree:: fobi.contrib.apps.drf_integration.form_elements.content.content_image + fobi.contrib.apps.drf_integration.form_elements.content.content_image_url + fobi.contrib.apps.drf_integration.form_elements.content.content_text + fobi.contrib.apps.drf_integration.form_elements.content.content_video Module contents --------------- diff --git a/docs/fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.rst b/docs/fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.rst new file mode 100644 index 00000000..d5bfd349 --- /dev/null +++ b/docs/fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.rst @@ -0,0 +1,38 @@ +fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down package +============================================================================= + +Submodules +---------- + +fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.apps module +--------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.apps + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.base module +--------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.base + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.fobi_integration_form_elements module +----------------------------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down.fobi_integration_form_elements + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/fobi.contrib.apps.drf_integration.form_elements.fields.rst b/docs/fobi.contrib.apps.drf_integration.form_elements.fields.rst index 44e78cc9..190e4990 100644 --- a/docs/fobi.contrib.apps.drf_integration.form_elements.fields.rst +++ b/docs/fobi.contrib.apps.drf_integration.form_elements.fields.rst @@ -9,6 +9,7 @@ Subpackages fobi.contrib.apps.drf_integration.form_elements.fields.boolean fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple fobi.contrib.apps.drf_integration.form_elements.fields.date + fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down fobi.contrib.apps.drf_integration.form_elements.fields.datetime fobi.contrib.apps.drf_integration.form_elements.fields.decimal fobi.contrib.apps.drf_integration.form_elements.fields.email @@ -26,6 +27,7 @@ Subpackages fobi.contrib.apps.drf_integration.form_elements.fields.select fobi.contrib.apps.drf_integration.form_elements.fields.select_model_object fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple + fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_with_max fobi.contrib.apps.drf_integration.form_elements.fields.slider fobi.contrib.apps.drf_integration.form_elements.fields.slug diff --git a/docs/fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.rst b/docs/fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.rst new file mode 100644 index 00000000..22f47632 --- /dev/null +++ b/docs/fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.rst @@ -0,0 +1,38 @@ +fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects package +============================================================================================ + +Submodules +---------- + +fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.apps module +------------------------------------------------------------------------------------------------ + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.apps + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.base module +------------------------------------------------------------------------------------------------ + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.base + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.fobi_integration_form_elements module +-------------------------------------------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects.fobi_integration_form_elements + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_model_objects + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/fobi.contrib.apps.drf_integration.rst b/docs/fobi.contrib.apps.drf_integration.rst index 45e2128d..62301edf 100644 --- a/docs/fobi.contrib.apps.drf_integration.rst +++ b/docs/fobi.contrib.apps.drf_integration.rst @@ -28,14 +28,6 @@ fobi.contrib.apps.drf_integration.base module :undoc-members: :show-inheritance: -fobi.contrib.apps.drf_integration.codebin module ------------------------------------------------- - -.. automodule:: fobi.contrib.apps.drf_integration.codebin - :members: - :undoc-members: - :show-inheritance: - fobi.contrib.apps.drf_integration.dynamic module ------------------------------------------------ @@ -60,6 +52,14 @@ fobi.contrib.apps.drf_integration.helpers module :undoc-members: :show-inheritance: +fobi.contrib.apps.drf_integration.metadata module +------------------------------------------------- + +.. automodule:: fobi.contrib.apps.drf_integration.metadata + :members: + :undoc-members: + :show-inheritance: + fobi.contrib.apps.drf_integration.serializers module ---------------------------------------------------- diff --git a/docs/fobi.contrib.plugins.form_elements.content.content_image_url.rst b/docs/fobi.contrib.plugins.form_elements.content.content_image_url.rst new file mode 100644 index 00000000..0560e9a9 --- /dev/null +++ b/docs/fobi.contrib.plugins.form_elements.content.content_image_url.rst @@ -0,0 +1,70 @@ +fobi.contrib.plugins.form_elements.content.content_image_url package +==================================================================== + +Submodules +---------- + +fobi.contrib.plugins.form_elements.content.content_image_url.apps module +------------------------------------------------------------------------ + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url.apps + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.plugins.form_elements.content.content_image_url.base module +------------------------------------------------------------------------ + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url.base + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.plugins.form_elements.content.content_image_url.conf module +------------------------------------------------------------------------ + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url.conf + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.plugins.form_elements.content.content_image_url.defaults module +---------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url.defaults + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.plugins.form_elements.content.content_image_url.fobi_form_elements module +-------------------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url.fobi_form_elements + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.plugins.form_elements.content.content_image_url.forms module +------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url.forms + :members: + :undoc-members: + :show-inheritance: + +fobi.contrib.plugins.form_elements.content.content_image_url.settings module +---------------------------------------------------------------------------- + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url.settings + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: fobi.contrib.plugins.form_elements.content.content_image_url + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/fobi.contrib.plugins.form_elements.content.rst b/docs/fobi.contrib.plugins.form_elements.content.rst index 1e6fb24f..a13e3467 100644 --- a/docs/fobi.contrib.plugins.form_elements.content.rst +++ b/docs/fobi.contrib.plugins.form_elements.content.rst @@ -7,6 +7,7 @@ Subpackages .. toctree:: fobi.contrib.plugins.form_elements.content.content_image + fobi.contrib.plugins.form_elements.content.content_image_url fobi.contrib.plugins.form_elements.content.content_text fobi.contrib.plugins.form_elements.content.content_video diff --git a/docs/fobi.migrations.rst b/docs/fobi.migrations.rst index 8580f06a..21592cd2 100644 --- a/docs/fobi.migrations.rst +++ b/docs/fobi.migrations.rst @@ -108,6 +108,14 @@ fobi.migrations.0013_formwizardentry_show_all_navigation_buttons module :undoc-members: :show-inheritance: +fobi.migrations.0014_auto_20170516_1413 module +---------------------------------------------- + +.. automodule:: fobi.migrations.0014_auto_20170516_1413 + :members: + :undoc-members: + :show-inheritance: + Module contents --------------- diff --git a/docs/index.rst b/docs/index.rst index 42803290..8d3e5743 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2322,6 +2322,34 @@ PhantomJS. If you want to use Firefox for testing, remove or comment-out the ``PHANTOM_JS_EXECUTABLE_PATH`` setting. +Writing documentation +===================== +Keep the following hierarchy. + +.. code-block:: text + + ===== + title + ===== + + header + ====== + + sub-header + ---------- + + sub-sub-header + ~~~~~~~~~~~~~~ + + sub-sub-sub-header + ################## + + sub-sub-sub-sub-header + ^^^^^^^^^^^^^^^^^^^^^^ + + sub-sub-sub-sub-sub-header + ++++++++++++++++++++++++++ + Troubleshooting =============== If you get a ``FormElementPluginDoesNotExist`` or a @@ -2340,6 +2368,8 @@ Author ====== Artur Barseghyan + + Screenshots =========== Bootstrap3 theme @@ -2361,7 +2391,7 @@ Create a form View/edit form ~~~~~~~~~~~~~~ Form elements -+++++++++++++ +############# .. [1.3] Edit form - form elements tab active, no elements yet .. image:: _static/bootstrap3/03_edit_form_-_form_elements_tab_active_-_no_elements_yet.png @@ -2383,7 +2413,7 @@ Form elements :scale: 80 % Form handlers -+++++++++++++ +############# .. [1.7] Edit form - form handlers tab active, no handlers yet @@ -2474,6 +2504,8 @@ View/edit form .. image:: _static/simple/06_view_form.png :scale: 80 % + + Documentation ============= Contents: @@ -2483,6 +2515,8 @@ Contents: fobi quickstart + changelog + licenses Indices and tables ================== @@ -2491,3 +2525,4000 @@ Indices and tables * :ref:`modindex` * :ref:`search` + + +(Sub)modules +============ +Some additional documentation on ``django-fobi`` sub-modules are listed +below. + + +fobi.contrib.apps.djangocms_integration +--------------------------------------- +A ``django-fobi`` integration with DjangoCMS. + +Prerequisites +~~~~~~~~~~~~~ +Has been tested with DjangoCMS 2.4.3 and 3.0.6 only. Might work on earlier (or +later) versions as well. + +Installation +~~~~~~~~~~~~ +Versions +######## +See the requirements files: + +- `DjangoCMS 2.4.3 requirements + `_. +- `DjangoCMS 3.0.6 requirements + `_. + +your_project/settings.py +######################## +See the example settings files: + +- `DjangoCMS 2.4.3 settings + `_. +- `DjangoCMS 3.0.6 settings + `_. + +.. code-block:: python + + INSTALLED_APPS = list(INSTALLED_APPS) + INSTALLED_APPS += [ + 'cms', # FeinCMS + + 'fobi.contrib.apps.djangocms_integration', # Fobi DjangoCMS app + ] + +Information for developers +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Templates for DjangoCMS +####################### +Django-CMS templates are quite specific and in some aspects are not 100% +compatible with built-in themes (due to the fact that DjangoCMS intensively +makes use of ``django-sekizai`` which isn't used in the generic templates). + +That does not anyhow affect the core ``fobi`` and the built-in themes, +although you can't magically reuse built-in ``fobi`` themes with Django-CMS +(as it's done for `FeinCMS page templates +`_). + +You would have to make custom page templates from scratch (or based on a +copy of the desired bundled template). See how I did it for all bundled themes +`here +`_: + +- `Bootstrap 3 + `_ +- `Foundation 5 + `_ +- `Simple + `_ + +Template rendering +################## +The embed DjangoCMS widget is rendered with use of two theme templates: + +- ``view_embed_form_entry_ajax_template``: Used for rendering the form. +- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form + sent event. + +Using custom templates for rendering the widget +############################################### +In the widget, you can specify a template which you want to be used for +rendering the form or the form-sent event. + +Example: + +.. code-block:: python + + FOBI_DJANGOCMS_INTEGRATION_FORM_TEMPLATE_CHOICES = ( + ("yourapp/custom_view_embed_form_v1.html", + "Custom embed form view template #1"), + ("yourapp/custom_view_embed_form_v2.html", + "Custom embed form view template #2"), + ) + +Same goes for form-sent templates. + +.. code-block:: python + + FOBI_DJANGOCMS_INTEGRATION_SUCCESS_PAGE_TEMPLATE_CHOICES = ( + ("yourapp/custom_embed_form_submitted_v1.html", + "Custom form-sent template #1"), + ("yourapp/custom_embed_form_submitted_v2.html", + "Custom form-sent template #2"), + ) + +Registering a template in the ``FORM_TEMPLATE_CHOICES`` makes it available +for all the themes. If you rather want to use different custom templates +for different themes, use the ``FOBI_CUSTOM_THEME_DATA`` as shown in the +example below. + +.. code-block:: python + + FOBI_CUSTOM_THEME_DATA = { + 'bootstrap3': { + 'djangocms_integration': { + 'form_template_choices': [ + ('fobi/bootstrap3_extras/view_embed_form.html', + "Custom bootstrap3 embed form view template"), + ], + 'success_page_template_choices': [ + ('fobi/bootstrap3_extras/embed_form_submitted.html', + "Custom bootstrap3 embed form entry submitted template"), + ], + }, + }, + 'foundation5': { + 'djangocms_integration': { + 'form_template_choices': [ + ('fobi/foundation5_extras/view_embed_form.html', + "Custom foundation5 embed form view template"), + ], + 'success_page_template_choices': [ + ('fobi/foundation5_extras/embed_form_submitted.html', + "Custom foundation5 embed form entry submitted template"), + ], + }, + }, + } + +Usage +~~~~~ +The ``fobi.contrib.apps.djangocms_integration.models.FobiFormWidget`` consists +of the following fields: + +- Form: The form to be used. +- Form template name: Template to be used to render the embed form. +- Hide form title: If checked, no form title would be shown. +- Form title: Overrides the standard form title. +- Submit button text: Overrides the default submit button text. +- Success page template name: Template to be used to render the embed form-sent + event. +- Hide success page title: If checked, no form-sent title would be shown. +- Success page title: Overrides the form-sent title. +- Success page text: Overrides the form-sent text. + + +fobi.contrib.apps.drf_integration +--------------------------------- +A ``django-fobi`` integration with ``Django REST framework``. + +Supported actions are: + +- `LIST`_: List all the forms. +- `OPTIONS`_: Describe the given form. +- `PUT`_: Submit form data. + +Live demo +~~~~~~~~~ +Live demo is available on Heroku. + +- `The core `_ +- `Django REST framework integration `_ + +Supported fields +~~~~~~~~~~~~~~~~ +The following fields are supported. + +Content (presentational form elements) +###################################### +Unlike standard fields, ``content`` fields are purely presentational. +You're not supposed to make write actions on them (it won't work). Neither +will they be displayed in the browsable API (list/retrieve actions). However, +they will be listed in the options action call. All content fields are of type +"content". + +- content_image +- content_image_url +- content_text +- content_video + +Fields +###### +- boolean +- checkbox_select_multiple +- date +- date_drop_down +- datetime +- decimal +- email +- file +- float +- hidden (in terms of the Django REST framework - a read-only field) +- input (some sort of a copy of ``text`` plugin) +- integer +- ip_address +- null_boolean +- password (some sort of a copy of ``text`` plugin) +- radio +- range_select +- regex +- select +- select_multiple +- select_multiple_with_max +- slider (just a copy of range_select, for compatibility with main package) +- slug +- text +- textarea (some sort of a copy of ``text`` plugin) +- time +- url + +Not (yet) supported fields +~~~~~~~~~~~~~~~~~~~~~~~~~~ +The following fields are not supported. Those marked with asterisk are planned +to be supported in the upcoming releases. + +- select_model_object +- select_mptt_model_object +- select_multiple_model_objects +- select_multiple_mptt_model_objects + +Implementation details +~~~~~~~~~~~~~~~~~~~~~~ +Each ``django-fobi`` plugin has its' own representative integration plugin +within ``fobi.contrib.aps.drf_integration`` package. + +Some of the plugins may seam to have zero-added-value and in fact they are. +For instance, DRF integration ``slider`` plugin is just an exact copy of the +``range_select`` plugin, created in order to provide exactly the same form +fields generated in the API. + +You should mention all the plugins you want to use explicitly in the +project settings. Thus, if you have used (included in the ``INSTALLED_APPS``) +the core plugins: + +- fobi.contrib.plugins.form_elements.fields.boolean +- fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple +- fobi.contrib.plugins.form_elements.fields.date +- fobi.contrib.plugins.form_elements.fields.date_drop_down +- fobi.contrib.plugins.form_elements.fields.datetime +- fobi.contrib.plugins.form_elements.fields.decimal +- fobi.contrib.plugins.form_elements.fields.email +- 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.input +- fobi.contrib.plugins.form_elements.fields.integer +- fobi.contrib.plugins.form_elements.fields.ip_address +- fobi.contrib.plugins.form_elements.fields.null_boolean +- fobi.contrib.plugins.form_elements.fields.password +- fobi.contrib.plugins.form_elements.fields.radio +- fobi.contrib.plugins.form_elements.fields.range_select +- fobi.contrib.plugins.form_elements.fields.regex +- fobi.contrib.plugins.form_elements.fields.select +- fobi.contrib.plugins.form_elements.fields.select_multiple +- fobi.contrib.plugins.form_elements.fields.select_multiple_with_max +- fobi.contrib.plugins.form_elements.fields.slider +- fobi.contrib.plugins.form_elements.fields.slug +- fobi.contrib.plugins.form_elements.fields.text +- fobi.contrib.plugins.form_elements.fields.textarea +- fobi.contrib.plugins.form_elements.fields.time +- fobi.contrib.plugins.form_elements.fields.url +- fobi.contrib.plugins.form_elements.content.content_image +- fobi.contrib.plugins.form_elements.content.content_image_url +- fobi.contrib.plugins.form_elements.content.content_text +- fobi.contrib.plugins.form_elements.content.content_video +- fobi.contrib.plugins.form_handlers.db_store +- fobi.contrib.plugins.form_handlers.http_repost +- fobi.contrib.plugins.form_handlers.mail + +You should include their correspondent Django REST framework implementations +in the ``INSTALLED_APPS`` as well: + +- fobi.contrib.apps.drf_integration.form_elements.fields.boolean +- fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple +- fobi.contrib.apps.drf_integration.form_elements.fields.date +- fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down +- fobi.contrib.apps.drf_integration.form_elements.fields.datetime +- fobi.contrib.apps.drf_integration.form_elements.fields.decimal +- fobi.contrib.apps.drf_integration.form_elements.fields.email +- fobi.contrib.apps.drf_integration.form_elements.fields.file +- fobi.contrib.apps.drf_integration.form_elements.fields.float +- fobi.contrib.apps.drf_integration.form_elements.fields.hidden +- fobi.contrib.apps.drf_integration.form_elements.fields.input +- fobi.contrib.apps.drf_integration.form_elements.fields.integer +- fobi.contrib.apps.drf_integration.form_elements.fields.ip_address +- fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean +- fobi.contrib.apps.drf_integration.form_elements.fields.password +- fobi.contrib.apps.drf_integration.form_elements.fields.radio +- fobi.contrib.apps.drf_integration.form_elements.fields.range_select +- fobi.contrib.apps.drf_integration.form_elements.fields.regex +- fobi.contrib.apps.drf_integration.form_elements.fields.select +- fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple +- fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_with_max +- fobi.contrib.apps.drf_integration.form_elements.fields.slider +- fobi.contrib.apps.drf_integration.form_elements.fields.slug +- fobi.contrib.apps.drf_integration.form_elements.fields.text +- fobi.contrib.apps.drf_integration.form_elements.fields.textarea +- fobi.contrib.apps.drf_integration.form_elements.fields.time +- fobi.contrib.apps.drf_integration.form_elements.fields.url +- fobi.contrib.apps.drf_integration.form_elements.content.content_image +- fobi.contrib.apps.drf_integration.form_elements.content.content_image_url +- fobi.contrib.apps.drf_integration.form_elements.content.content_text +- fobi.contrib.apps.drf_integration.form_elements.content.content_video +- fobi.contrib.apps.drf_integration.form_handlers.db_store +- fobi.contrib.apps.drf_integration.form_handlers.http_repost +- fobi.contrib.apps.drf_integration.form_handlers.mail + +Installation +~~~~~~~~~~~~ +Versions +######## +Was made with ``djangorestframework`` 3.6.2. May work on earlier versions, +although not guaranteed. + +See the `requirements file +`_. + +your_project/settings.py +######################## +See the `example settings file +`_. + +.. code-block:: python + + INSTALLED_APPS = list(INSTALLED_APPS) + INSTALLED_APPS += [ + # ... + # Here should come a list of form element plugins of the core + # package, followed by the list of form handler plugins of the core + # package, followed by the list of themes of the core package and + # all other apps that do matter. + # ... + 'rest_framework', # Django REST framework + 'fobi.contrib.apps.drf_integration', # DRF integration app + + # DRF integration form element plugins - fields + 'fobi.contrib.apps.drf_integration.form_elements.fields.boolean', + 'fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple', + 'fobi.contrib.apps.drf_integration.form_elements.fields.date', + 'fobi.contrib.apps.drf_integration.form_elements.fields.datetime', + 'fobi.contrib.apps.drf_integration.form_elements.fields.decimal', + 'fobi.contrib.apps.drf_integration.form_elements.fields.email', + 'fobi.contrib.apps.drf_integration.form_elements.fields.file', + 'fobi.contrib.apps.drf_integration.form_elements.fields.float', + 'fobi.contrib.apps.drf_integration.form_elements.fields.hidden', + 'fobi.contrib.apps.drf_integration.form_elements.fields.input', + 'fobi.contrib.apps.drf_integration.form_elements.fields.integer', + 'fobi.contrib.apps.drf_integration.form_elements.fields.ip_address', + 'fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean', + 'fobi.contrib.apps.drf_integration.form_elements.fields.password', + 'fobi.contrib.apps.drf_integration.form_elements.fields.radio', + 'fobi.contrib.apps.drf_integration.form_elements.fields.range_select', + 'fobi.contrib.apps.drf_integration.form_elements.fields.regex', + 'fobi.contrib.apps.drf_integration.form_elements.fields.select', + 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple', + 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_with_max', + 'fobi.contrib.apps.drf_integration.form_elements.fields.slider', + 'fobi.contrib.apps.drf_integration.form_elements.fields.slug', + 'fobi.contrib.apps.drf_integration.form_elements.fields.text', + 'fobi.contrib.apps.drf_integration.form_elements.fields.textarea', + 'fobi.contrib.apps.drf_integration.form_elements.fields.time', + 'fobi.contrib.apps.drf_integration.form_elements.fields.url', + + # DRF integration form element plugins - presentational + 'fobi.contrib.apps.drf_integration.form_elements.content.content_image', + 'fobi.contrib.apps.drf_integration.form_elements.content.content_image_url', + 'fobi.contrib.apps.drf_integration.form_elements.content.content_text', + 'fobi.contrib.apps.drf_integration.form_elements.content.content_video', + + # DRF integration form handler plugins + 'fobi.contrib.apps.drf_integration.form_handlers.db_store', + 'fobi.contrib.apps.drf_integration.form_handlers.mail', + 'fobi.contrib.apps.drf_integration.form_handlers.http_repost', + # ... + ] + +your_project/urls.py +#################### +Add the following code to the main ``urls.py`` of your project: + +.. code-block:: python + + # Conditionally including django-rest-framework integration app + if 'fobi.contrib.apps.drf_integration' in settings.INSTALLED_APPS: + from fobi.contrib.apps.drf_integration.urls import fobi_router + urlpatterns += [ + url(r'^api/', include(fobi_router.urls)) + ] + +Usage +~~~~~ +If you have followed the steps above precisely, you would be able to access +the API using ``http://localhost:8000/api/fobi-form-entry/``. + +Actions/methods supported: + +LIST +#### +.. code-block:: text + + GET /api/fobi-form-entry/ + +Lists all the forms available. Anonymous users would see the list of all +public forms. Authenticated users would see their own forms in addition +to the public forms. + +OPTIONS +####### +.. code-block:: text + + OPTIONS /api/fobi-form-entry/{FORM_SLUG}/ + +Lists all field options for the selected form. Private forms would be only +visible to authenticated users. + +PUT +### +.. code-block:: text + + PUT /api/fobi-form-entry/{FORM_SLUG}/ + + {DATA} + +Callbacks +~~~~~~~~~ +Callbacks work just the same way the core callbacks work. + +fobi_form_callbacks.py +###################### +.. code-block:: python + + from fobi.base import ( + integration_form_callback_registry, + IntegrationFormCallback, + ) + + from fobi.constants import ( + CALLBACK_BEFORE_FORM_VALIDATION, + CALLBACK_FORM_INVALID, + CALLBACK_FORM_VALID, + CALLBACK_FORM_VALID_AFTER_FORM_HANDLERS, + CALLBACK_FORM_VALID_BEFORE_SUBMIT_PLUGIN_FORM_DATA, + ) + + from fobi.contrib.apps.drf_integration import UID as INTEGRATE_WITH + + + class DRFSaveAsFooItem(IntegrationFormCallback): + """Save the form as a foo item, if certain conditions are met.""" + + stage = CALLBACK_FORM_VALID + integrate_with = INTEGRATE_WITH + + def callback(self, form_entry, request, **kwargs): + """Custom callback login comes here.""" + logger.debug("Great! Your form is valid!") + + + class DRFDummyInvalidCallback(IntegrationFormCallback): + """Saves the form as a foo item, if certain conditions are met.""" + + stage = CALLBACK_FORM_INVALID + integrate_with = INTEGRATE_WITH + + def callback(self, form_entry, request, **kwargs): + """Custom callback login comes here.""" + logger.debug("Damn! You've made a mistake, boy!") + +Testing +~~~~~~~ +To test Django REST framework integration package only, run the following +command: + +.. code-block:: sh + + ./runtests.py src/fobi/tests/test_drf_integration.py + +or use plain Django tests: + +.. code-block:: sh + + ./manage.py test fobi.tests.test_drf_integration --settings=settings.test + +Limitations +~~~~~~~~~~~ +Certain fields are not available yet (relational fields). + + +Form elements +------------- + + +Content form element +~~~~~~~~~~~~~~~~~~~~ +Presentational form elements for ``drf_integration``. + + +fobi.contrib.apps.drf_integration.form_elements.content.content_image +##################################################################### +A ``django-fobi`` ContentImage plugin for integration with +``Django REST framework``. Makes use of the +``fobi.contrib.apps.drf_integration.fields.ContentImage``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_image`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.content.content_image', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + +Usage +^^^^^ +Unlike standard fields, ``ContentImage`` field is purely presentational. +You're not supposed to make write actions on it (it won't work). Neither +will it be displayed in the browsable API (list/retrieve actions). However, +it will be listed in the options action call. + +**Sample JSON response fragment** + +.. code-block:: javascript + + "actions": { + "PUT": { + // ... + "content_image_89c8c319-195b-487a-a44d-f59ef14a5d44": { + "type": "content", + "required": false, + "read_only": true, + "contenttype": "image", + "content": "\n

\n\n\n\n\n\"Lorem\n\n\n

\n", + "raw": { + "file": "/media/fobi_plugins/content_image/test-image.jpg", + "alt": "Lorem ipsum", + "fit_method": "center", + "size": "500x500" + } + }, + // ... + } + } + +**JSON response fragment explained** + +- ``type`` (str): Set to "content" for all presentational form elements. +- ``contenttype`` (str): Set to "image" for ``ContentImage`` field. +- ``content`` (str): Representation of the content. Rendered partial HTML. +- ``raw`` (json dict): Raw attributes of the ``ContentImage`` plugin. Contains + "file", "alt", "fit_method" and "size" attributes. + + +fobi.contrib.apps.drf_integration.form_elements.content.content_image_url +######################################################################### +A ``django-fobi`` ContentImageURL plugin for integration with +``Django REST framework``. Makes use of the +``fobi.contrib.apps.drf_integration.fields.ContentImage``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_image_url`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.content.content_image_url', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + +Usage +^^^^^ +Unlike standard fields, ``ContentImageURL`` field is purely presentational. +You're not supposed to make write actions on it (it won't work). Neither +will it be displayed in the browsable API (list/retrieve actions). However, +it will be listed in the options action call. + +**Sample JSON response fragment** + +.. code-block:: javascript + + "actions": { + "PUT": { + // ... + "content_image_89c8c319-195b-487a-a44d-f59ef14a5d44": { + "type": "content", + "required": false, + "read_only": true, + "contenttype": "image", + "content": "\n

\n\n\n\n\n\"Lorem\n\n\n

\n", + "raw": { + "url": "http://example.com/media/test-image.jpg", + "alt": "Lorem ipsum", + "fit_method": "fit_width", + "size": "500x500" + } + }, + // ... + } + } + +**JSON response fragment explained** + +- ``type`` (str): Set to "content" for all presentational form elements. +- ``contenttype`` (str): Set to "image" for ``ContentImageURL`` field. +- ``content`` (str): Representation of the content. Rendered partial HTML. +- ``raw`` (json dict): Raw attributes of the ``ContentImageURL`` plugin. + Contains "url", "alt", "fit_method" and "size" attributes. + + +fobi.contrib.apps.drf_integration.form_elements.content.content_text +#################################################################### +A ``django-fobi`` ContentText plugin for integration with +``Django REST framework``. Makes use of the +``fobi.contrib.apps.drf_integration.fields.ContentText``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_text`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.content.content_text', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + +Usage +^^^^^ +Unlike standard fields, ``ContentText`` field is purely presentational. +You're not supposed to make write actions on it (it won't work). Neither +will it be displayed in the browsable API (list/retrieve actions). However, +it will be listed in the options action call. + +**Sample JSON response fragment** + +.. code-block:: javascript + + "actions": { + "PUT": { + // ... + "content_text_89c8c319-195b-487a-a44d-f59ef14a5d44": { + "type": "content", + "required": false, + "read_only": true, + "contenttype": "text", + "content": "\n

\n\nLorem ipsum dolor sit amet.\n\n\n

\n", + "raw": { + "text": "Lorem ipsum dolor sit amet." + } + }, + // ... + } + } + +**JSON response fragment explained** + +- ``type`` (str): Set to "content" for all presentational form elements. +- ``contenttype`` (str): Set to "text" for ``ContentText`` field. +- ``content`` (str): Representation of the content. Rendered partial HTML. +- ``raw`` (json dict): Raw attributes of the ``ContentText`` plugin. Contains + "text" attribute. + + +fobi.contrib.apps.drf_integration.form_elements.content.content_video +##################################################################### +A ``django-fobi`` ContentVideo plugin for integration with +``Django REST framework``. Makes use of the +``fobi.contrib.apps.drf_integration.fields.ContentVideo``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_video`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.content.content_video', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + +Usage +^^^^^ +Unlike standard fields, ``ContentVideo`` field is purely presentational. +You're not supposed to make write actions on it (it won't work). Neither +will it be displayed in the browsable API (list/retrieve actions). However, +it will be listed in the options action call. + +**Sample JSON response fragment** + +.. code-block:: javascript + + "actions": { + "PUT": { + // ... + "content_video_41a6b951-e6f9-4f08-ada6-3b109aa9a72f": { + "type": "content", + "required": false, + "read_only": true, + "contenttype": "video", + "content": "\n\n", + "raw": { + "title": "Cras risus ipsum faucibus", + "url": "https://www.youtube.com/watch?v=3P1qcVcs4Ik", + "size": "500x400" + } + }, + // ... + } + } + +**JSON response fragment explained** + +- ``type`` (str): Set to "content" for all presentational form elements. +- ``contenttype`` (str): Set to "video" for ``ContentVideo`` field. +- ``content`` (str): Representation of the content. Rendered partial HTML. +- ``raw`` (json dict): Raw attributes of the ``ContentVideo`` plugin. Contains + "title", "url" and "size" attributes. + + +Fields +~~~~~~ +Form fields for ``drf_integration``. + + +fobi.contrib.apps.drf_integration.form_elements.fields.boolean +############################################################## +A ``django-fobi`` BooleanField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.BooleanField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.boolean`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.boolean', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple +############################################################################### +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.MultipleChoiceField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.date +########################################################### +A ``django-fobi`` DateField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.DateField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.date`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.date', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down +##################################################################### +A ``django-fobi`` DateField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.DateField``. + +This plugin has been made primarily for compatibility with ``date_drop_down`` +plugin of the core package. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.datetime +############################################################### +A ``django-fobi`` DateField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.DateTimeField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.datetime`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.datetime', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.decimal +############################################################## +A ``django-fobi`` DecimalField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.DecimalField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.decimal`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.decimal', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.email +############################################################ +A ``django-fobi`` EmailField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.EmailField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.email`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.email', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.file +########################################################### +A ``django-fobi`` FileField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.FileField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.file`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.file', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.float +############################################################ +A ``django-fobi`` FloatField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.FloatField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.float`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.float', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.hidden +############################################################# +A ``django-fobi`` HiddenField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.HiddenField``. + +Note, that in terms of the Django REST framework it is a read-only field. +Any values posted along won't be saved. Initial value would. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.hidden`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.hidden', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.input +############################################################ +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.CharField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.input`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.input', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.integer +############################################################## +A ``django-fobi`` IntegerField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.IntegerField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.integer`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.integer', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.ip_address +################################################################# +A ``django-fobi`` IPAddressField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.IPAddressField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.ip_address`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.ip_address', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean +################################################################### +A ``django-fobi`` NullBooleanField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.NullBooleanField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.password +############################################################### +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.CharField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.password`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.password', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.radio +############################################################ +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.ChoiceField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.radio`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.radio', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.range_select +################################################################### +A ``django-fobi`` ChoiceField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.ChoiceField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.range_select`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.range_select', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.regex +############################################################ +A ``django-fobi`` RegexField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.RegexField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.regex`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.regex', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.select +############################################################# +A ``django-fobi`` ChoiceField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.ChoiceField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.select`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.select', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple +###################################################################### +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.MultipleChoiceField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple +###################################################################### +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.MultipleChoiceField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.slider +############################################################# +A ``django-fobi`` ChoiceField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.ChoiceField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.slider`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.slider', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.slug +########################################################### +A ``django-fobi`` SlugField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.SlugField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.slug`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.slug', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.text +########################################################### +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.CharField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.text`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.text', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.textarea +############################################################### +A ``django-fobi`` CharField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.CharField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.textarea`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.textarea', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.time +########################################################### +A ``django-fobi`` TimeField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.TimeField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.time`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.time', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_elements.fields.url +########################################################## +A ``django-fobi`` URLField plugin for integration with +``Django REST framework``. Makes use of the +``rest_framework.fields.URLField``. + +Installation +^^^^^^^^^^^^ +1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.time`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_elements.fields.url', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +Form handlers +------------- +Form handlers for ``drf_integration``. + + +fobi.contrib.apps.drf_integration.form_handlers.db_store +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +A ``django-fobi`` Mail form handler plugin for integration +with ``Django REST framework``. Saves submitted form data into the +``SavedFormDataEntry`` model. + +Installation +############ +1. Add ``fobi.contrib.apps.drf_integration.form_handlers.db_store`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_handlers.db_store', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./manage.py migrate + + ./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. + + +fobi.contrib.apps.drf_integration.form_handlers.http_repost +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +A ``django-fobi`` HTTP repost form handler plugin for integration +with ``Django REST framework``. Submits the form to another endpoint specified. + +Installation +############ +1. Add ``fobi.contrib.apps.drf_integration.form_handlers.http_respost`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_handlers.http_repost', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./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. + + +fobi.contrib.apps.drf_integration.form_handlers.mail +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +A ``django-fobi`` Mail form handler plugin for integration +with ``Django REST framework``. Submits the form data by email to the +specified email address. + +Installation +############ +1. Add ``fobi.contrib.apps.drf_integration.form_handlers.mail`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + +.. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.apps.drf_integration.form_handlers.mail', + # ... + ) + +2. In the terminal type: + +.. code-block:: sh + + ./manage.py migrate + + ./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. + + +fobi.contrib.apps.feincms_integration +------------------------------------- +A ``django-fobi`` integration with FeinCMS. + +Installation +~~~~~~~~~~~~ +Versions +######## +See the `requirements file +`_. + +your_project/settings.py +######################## +See the `example settings file +`_. + +.. code-block:: python + + INSTALLED_APPS = list(INSTALLED_APPS) + INSTALLED_APPS += [ + 'feincms', # FeinCMS + + 'fobi.contrib.apps.feincms_integration', # Fobi FeinCMS app + + 'page', # Example + ] + + FEINCMS_RICHTEXT_INIT_CONTEXT = { + 'TINYMCE_JS_URL': STATIC_URL + 'tiny_mce/tiny_mce.js', + } + +your_project/page/models.py +########################### +.. code-block:: python + + from django.utils.translation import ugettext_lazy as _ + + from feincms.module.page.models import Page + from feincms.content.raw.models import RawContent + from feincms.content.richtext.models import RichTextContent + # Import the ``django-fobi`` widget. + from fobi.contrib.apps.feincms_integration.widgets import FobiFormWidget + + Page.register_extensions('feincms.module.extensions.translations',) + + # Register basic template. + Page.register_templates( + { + 'title': _(u"Base template"), + 'path': 'page/base.html', + 'key': 'page_base', + 'regions': ( + ('main', _(u"Main")), + ('sidebar', _(u"Sidebar")), + ) + }, + ) + + # Standard content types + Page.create_content_type(RawContent) + Page.create_content_type(RichTextContent) + + # Register the ``django-fobi`` widget. + Page.create_content_type(FobiFormWidget) + +your_project/admin.py +##################### +.. code-block:: python + + from django.contrib import admin + + from feincms.module.page.modeladmins import PageAdmin + + from page.models import Page + + admin.site.register(Page, PageAdmin) + +Information for developers +########################## +Template rendering +^^^^^^^^^^^^^^^^^^ +The embed FeinCMS widget is rendered with use of two theme templates: + +- ``view_embed_form_entry_ajax_template``: Used for rendering the form. +- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form + sent event. + +Using custom templates for rendering the widget +############################################### +In the widget, you can specify a template which you want to be used for +rendering the form or the form-sent event. + +Example: + +.. code-block:: python + + FOBI_FEINCMS_INTEGRATION_FORM_TEMPLATE_CHOICES = ( + ("yourapp/custom_view_embed_form_v1.html", + "Custom embed form view template #1"), + ("yourapp/custom_view_embed_form_v2.html", + "Custom embed form view template #2"), + ) + +Same goes for form-sent templates. + +.. code-block:: python + + FOBI_FEINCMS_INTEGRATION_SUCCESS_PAGE_TEMPLATE_CHOICES = ( + ("yourapp/custom_embed_form_submitted_v1.html", + "Custom form-sent template #1"), + ("yourapp/custom_embed_form_submitted_v2.html", + "Custom form-sent template #2"), + ) + +Registering a template in the ``FORM_TEMPLATE_CHOICES`` makes it available +for all the themes. If you rather want to use different custom templates +for different themes, use the ``FOBI_CUSTOM_THEME_DATA`` as shown in the +example below. + +.. code-block:: python + + FOBI_CUSTOM_THEME_DATA = { + 'bootstrap3': { + 'feincms_integration': { + 'form_template_choices': [ + ('fobi/bootstrap3_extras/view_embed_form.html', + "Custom bootstrap3 embed form view template"), + ], + 'success_page_template_choices': [ + ('fobi/bootstrap3_extras/embed_form_submitted.html', + "Custom bootstrap3 embed form entry submitted template"), + ], + }, + }, + 'foundation5': { + 'feincms_integration': { + 'form_template_choices': [ + ('fobi/foundation5_extras/view_embed_form.html', + "Custom foundation5 embed form view template"), + ], + 'success_page_template_choices': [ + ('fobi/foundation5_extras/embed_form_submitted.html', + "Custom foundation5 embed form entry submitted template"), + ], + }, + }, + } + +Usage +~~~~~ +The ``fobi.contrib.apps.feincms_integration.widgets.FobiFormWidget`` consists +of the following fields: + +- Form: The form to be used. +- Form template name: Template to be used to render the embed form. +- Hide form title: If checked, no form title would be shown. +- Form title: Overrides the standard form title. +- Submit button text: Overrides the default submit button text. +- Success page template name: Template to be used to render the embed form-sent + event. +- Hide success page title: If checked, no form-sent title would be shown. +- Success page title: Overrides the form-sent title. +- Success page text: Overrides the form-sent text. + + +fobi.contrib.apps.mezzanine_integration +--------------------------------------- +A ``django-fobi`` integration with Mezzanine. + +Installation +~~~~~~~~~~~~ +Versions +######## +See the `requirements file +`_. + +your_project/settings.py +######################## +See the `example settings file +`_. + +.. code-block:: python + + INSTALLED_APPS = list(INSTALLED_APPS) + INSTALLED_APPS += [ + # Standard mezzanine apps + + 'fobi.contrib.apps.mezzanine_integration', # Fobi Mezzanine app + ] + +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. +- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form + 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. + +Example: + +.. code-block:: python + + FOBI_MEZZANINE_INTEGRATION_FORM_TEMPLATE_CHOICES = ( + ("yourapp/custom_view_embed_form_v1.html", + "Custom embed form view template #1"), + ("yourapp/custom_view_embed_form_v2.html", + "Custom embed form view template #2"), + ) + +Same goes for form-sent templates. + +.. code-block:: python + + FOBI_MEZZANINE_INTEGRATION_SUCCESS_PAGE_TEMPLATE_CHOICES = ( + ("yourapp/custom_embed_form_submitted_v1.html", + "Custom form-sent template #1"), + ("yourapp/custom_embed_form_submitted_v2.html", + "Custom form-sent template #2"), + ) + +Registering a template in the ``FORM_TEMPLATE_CHOICES`` makes it available +for all the themes. If you rather want to use different custom templates +for different themes, use the ``FOBI_CUSTOM_THEME_DATA`` as shown in the +example below. + +.. code-block:: python + + FOBI_CUSTOM_THEME_DATA = { + 'bootstrap3': { + 'mezzanine_integration': { + 'form_template_choices': [ + ('fobi/bootstrap3_extras/view_embed_form.html', + "Custom bootstrap3 embed form view template"), + ], + 'success_page_template_choices': [ + ('fobi/bootstrap3_extras/embed_form_submitted.html', + "Custom bootstrap3 embed form entry submitted template"), + ], + }, + }, + 'foundation5': { + 'mezzanine_integration': { + 'form_template_choices': [ + ('fobi/foundation5_extras/view_embed_form.html', + "Custom foundation5 embed form view template"), + ], + 'success_page_template_choices': [ + ('fobi/foundation5_extras/embed_form_submitted.html', + "Custom foundation5 embed form entry submitted template"), + ], + }, + }, + } + +Usage +~~~~~ +The ``fobi`` page model +####################### +The ``fobi.contrib.apps.mezzanine_integration.models.FobiFormPage`` consists +of the following fields: + +- Form: The form to be used. +- Form template name: Template to be used to render the embed form. +- Hide form title: If checked, no form title would be shown. +- Form title: Overrides the standard form title. +- Submit button text: Overrides the default submit button text. +- Success page template name: Template to be used to render the embed form-sent + event. +- Hide success page title: If checked, no form-sent title would be shown. +- Success page title: Overrides the form-sent title. +- Success page text: Overrides the form-sent text. + +Steps described +############### +1. If you use the 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. + + +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``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'easy_thumbnails', + 'fobi.contrib.plugins.form_elements.content.content_image', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(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. + + +fobi.contrib.plugins.form_elements.content.content_image_url +------------------------------------------------------------ +A ``Fobi`` ImageURL form element plugin. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.content.content_image_url`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.content.content_image_url', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Additionally, for the fine tuning, see the + ``fobi.contrib.plugins.form_elements.content.content_image_url.defaults`` + module. If necessary, override the settings by prepending + ``FOBI_PLUGIN_CONTENT_IMAGE_URL_`` to the desired variable name from the + above mentioned ``defaults`` module. + + +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``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.content.content_text', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(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 `_ 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 + + - ALLOWED_TAGS: + - ALLOWED_ATTRIBUTES: + + The default values are: + + .. code-block:: python + + ALLOWED_TAGS = [ + 'a', + 'abbr', + 'acronym', + 'b', + 'blockquote', + 'code', + 'em', + 'i', + 'li', + 'ol', + 'strong', + 'ul', + ] + + ALLOWED_ATTRIBUTES = { + 'a': ['href', 'title'], + 'abbr': ['title'], + 'acronym': ['title'], + } + + +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``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.content.content_video', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(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. + + +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``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.boolean', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +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``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(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): + + .. code-block:: python + + [ + ('alpha', 'Alpha'), + ('beta', 'Beta'), + ('gamma', 'Gamma'), + ] + + - "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. + +Usage +~~~~~ +You should be entering a single choice per line. Choice might +consist of just a single value or value/label pair. + +For example: + +.. code-block:: text + + 1 + 2 + alpha, Alpha + beta, Beta + omega + +The following HTML would be made of: + +.. code-block:: html + +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+ + +fobi.contrib.plugins.form_elements.fields.date +---------------------------------------------- +A ``Fobi`` Date form field plugin. Makes use of the +``django.forms.fields.DateField`` and ``django.forms.widgets.DateInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.date`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.date', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.date_drop_down +-------------------------------------------------------- +A ``Fobi`` Birthday form field plugin. Makes use of the +``django.forms.fields.DateField`` and +``django.forms.extras.widgets.SelectDateWidget``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.date_drop_down`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.date_drop_down', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.datetime +-------------------------------------------------- +A ``Fobi`` DateTime form field plugin. Makes use of the +``django.forms.fields.DateTimeField`` and +``django.forms.widgets.DateTimeInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.datetime`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.datetime', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.decimal +------------------------------------------------- +A ``Fobi`` Decimal form field plugin. Makes use of the +``django.forms.fields.DecimalField`` and ``django.forms.widgets.NumberInput`` +(falling back to ``django.forms.widgets.TextInput`` for older Django +versions). + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.decimal`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.decimal', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.email +----------------------------------------------- +A ``Fobi`` Email form field plugin. Makes use of the +``django.forms.fields.EmailField`` and ``django.forms.widgets.TextInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.email`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.email', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.file +---------------------------------------------- +A ``Fobi`` File form field plugin. Makes use of the +``django.forms.fields.FileField`` and +``django.forms.widgets.ClearableFileInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.file`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.file', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) By default uploaded files are stored in the "fobi_plugins/file" directory + of the media root. If you want to change the directory location, + set the ``FOBI_PLUGIN_FIELDS_FILE_FILES_UPLOAD_DIR`` value to the desired + (relative) path. + + +fobi.contrib.plugins.form_elements.fields.float +----------------------------------------------- +A ``Fobi`` Integer form field plugin. Makes use of the +``django.forms.fields.FloatField`` and ``django.forms.widgets.NumberInput`` +(falling back to ``django.forms.widgets.TextInput`` for older Django +versions). + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.float`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.float', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.hidden +------------------------------------------------ +A ``Fobi`` Hidden form field plugin. Makes use of the +``django.forms.fields.CharField`` and ``django.forms.widgets.HiddenInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.hidden`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.hidden', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.input +----------------------------------------------- +A generic input form field plugin. Makes use of the +``django.forms.fields.Field`` and ``django.forms.widgets.Input``. +Comes with a lot of options you likely won't use every day. + +The full list of supported HTML properties is listed below: + +- autocomplete +- autofocus +- disabled +- list +- max +- min +- multiple +- pattern +- placeholder +- readonly +- step +- type + +See `w3schools.com `_ for further +explanations. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.input`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.input', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.integer +------------------------------------------------- +A ``Fobi`` Integer form field plugin. Makes use of the +``django.forms.fields.IntegerField`` and ``django.forms.widgets.NumberInput`` +(falling back to ``django.forms.widgets.TextInput`` for older Django +versions). + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.integer`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.integer', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.ip_address +---------------------------------------------------- +A ``Fobi`` Text form field plugin. Makes use of the +``django.forms.fields.GenericIPAddressField`` and +``django.forms.widgets.TextInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.ip_address`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.ip_address', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.null_boolean +------------------------------------------------------ +A ``Fobi`` NullBoolean form field plugin. Makes use of the +``django.forms.fields.NullBooleanField`` and +``django.forms.widgets.NullBooleanSelect``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.null_boolean`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.null_boolean', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.password +-------------------------------------------------- +A ``Fobi`` Password form field plugin. Makes use of the +``django.forms.fields.CharField`` and ``django.forms.widgets.PasswordInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.password`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.password', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.radio +----------------------------------------------- +A ``Fobi`` Radio form field plugin. Makes use of the +``django.forms.fields.ChoiceField`` and ``django.forms.widgets.RadioSelect``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.radio`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.radio', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) By default, the submitted form value of `radio` + 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): + + .. code-block:: python + + [ + ('alpha', 'Alpha'), + ('beta', 'Beta'), + ('gamma', 'Gamma'), + ] + + .. code-block:: text + + - "val": `value` (example: "alpha"). + - "repr" (default): `label` (example: "Alpha"). + - "mix": `value (label)` (example: "Alpha (alpha)"). + + Simply set the + ``FOBI_FORM_ELEMENT_RADIO_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. + +For example: + +.. code-block:: text + + 1 + 2 + alpha, Alpha + beta, Beta + omega + +The following HTML would be made of: + +.. code-block:: html + + + + +fobi.contrib.plugins.form_elements.fields.range_select +------------------------------------------------------ +A ``Fobi`` RangeSelect form field plugin. Makes use of the +``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.range_select`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.range_select', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Ranges are specified within the given min/max values. The default values + are: + + .. code-block:: text + + - INITIAL: 50 + - INITIAL_MAX_VALUE: 100 + - INITIAL_MIN_VALUE: 0 + - MIN_VALUE: 0 + - MAX_VALUE: 100 + - STEP: 1 + + However, you can override each of them in the settings of your project by + prefixing correspondent names with `FOBI_FORM_ELEMENT_RANGE_SELECT_`: + + .. code-block:: text + + - FOBI_FORM_ELEMENT_RANGE_SELECT_INITIAL + - FOBI_FORM_ELEMENT_RANGE_SELECT_INITIAL_MAX_VALUE + - FOBI_FORM_ELEMENT_RANGE_SELECT_INITIAL_MIN_VALUE + - FOBI_FORM_ELEMENT_RANGE_SELECT_MIN_VALUE + - FOBI_FORM_ELEMENT_RANGE_SELECT_MAX_VALUE + - FOBI_FORM_ELEMENT_RANGE_SELECT_STEP + + +fobi.contrib.plugins.form_elements.fields.regex +----------------------------------------------- +A ``Fobi`` Text form field plugin. Makes use of the +``django.forms.fields.RegexField`` and ``django.forms.widgets.TextInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.regex`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.regex', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.select +------------------------------------------------ +A ``Fobi`` Select form field plugin. Makes use of the +``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.select`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.select', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) By default, the submitted form value of `select` + 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): + + .. code-block:: python + + [ + ('alpha', 'Alpha'), + ('beta', 'Beta'), + ('gamma', 'Gamma'), + ] + + .. code-block:: text + + - "val": `value` (example: "alpha"). + - "repr" (default): `label` (example: "Alpha"). + - "mix": `value (label)` (example: "Alpha (alpha)"). + + Simply set the + ``FOBI_FORM_ELEMENT_SELECT_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. + +For example: + +.. code-block:: text + + 1 + 2 + alpha, Alpha + beta, Beta + omega + +The following HTML would be made of: + +.. code-block:: html + + + + +fobi.contrib.plugins.form_elements.fields.select_model_object +------------------------------------------------------------- +A ``Fobi`` Select Model Object form field plugin. Makes use of the +``django.forms.models.ModelChoiceField`` and ``django.forms.widgets.Select``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.select_model_object`` to + the ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.select_model_object', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Make sure to take a look at + ``fobi.contrib.plugins.form_elements.fields.select_model_object.defaults.IGNORED_MODELS``. + If necessary, override it in your `settings` as shown in the example below: + + .. code-block:: python + + FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_IGNORED_MODELS = [ + 'auth.User', + 'auth.Group', + ] + +(5) By default, the submitted form value of `select_model_object` elements is + `app_label.model_name.object_pk.object_repr`. However, that part of the + behaviour has been made configurable. You can choose between the following + options: + + .. code-block:: text + + - "val": `app_label.model_name.object_pk.object_repr`. + - "repr": `object_repr` (uses the ``__unicode__`` method of the model). + - "mix" (default): `app_label.model_name.object_pk.object_repr`. + + Simply set the ``FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_SUBMIT_VALUE_AS`` + assign one of the following values: "val", "repr" or "mix" to get the + desired behaviour. + + +fobi.contrib.plugins.form_elements.fields.select_mptt_model_object +------------------------------------------------------------------ +A ``Fobi`` Select MPTT Model Object form field plugin. Makes use of the +``mptt.fields.TreeNodeChoiceField`` and ``django.forms.widgets.Select``. + +Installation +~~~~~~~~~~~~ +Install `django-mptt` +##################### +Taken from django-mptt `Getting started +`_. + +1. Download ``django-mptt`` using pip by running: + +.. code-block:: sh + + pip install django-mptt + +2. Add ``mptt`` to the ``INSTALLED_APPS`` in your ``settings.py``. + +Install `select_mptt_model_object` plugin +######################################### +(1) Add ``mptt`` and + ``fobi.contrib.plugins.form_elements.fields.select_mptt_model_object`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'mptt', + 'fobi.contrib.plugins.form_elements.fields.select_mptt_model_object', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Make sure to take a look at + ``fobi.contrib.plugins.form_elements.fields.select_mptt_model_object.defaults.IGNORED_MODELS``. + If necessary, override it in your `settings` as shown in the example below: + + .. code-block:: python + + FOBI_FORM_ELEMENT_SELECT_MPTT_MODEL_OBJECT_IGNORED_MODELS = [ + 'auth.User', + 'auth.Group', + ] + +(5) By default, the submitted form value of `select_mptt_model_object` elements + is `app_label.model_name.object_pk.object_repr`. However, that part of the + behaviour has been made configurable. You can choose between the following + options: + + .. code-block:: text + + - "val": `app_label.model_name.object_pk.object_repr`. + - "repr": `object_repr` (uses the ``__unicode__`` method of the model). + - "mix" (default): `app_label.model_name.object_pk.object_repr`. + + Simply set the ``FOBI_FORM_ELEMENT_SELECT_MPTT_MODEL_OBJECT_SUBMIT_VALUE_AS`` + assign one of the following values: "val", "repr" or "mix" to get the + desired behaviour. + + +fobi.contrib.plugins.form_elements.fields.select_multiple +--------------------------------------------------------- +A ``Fobi`` Select Multiple form field plugin. Makes use of the +``django.forms.fields.MultipleChoiceField`` and +``django.forms.widgets.SelectMultiple``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.select_multiple`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.select_multiple', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(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): + + .. code-block:: python + + [ + ('alpha', 'Alpha'), + ('beta', 'Beta'), + ('gamma', 'Gamma'), + ] + + .. code-block:: text + + - "val": `value` (example: "alpha"). + - "repr" (default): `label` (example: "Alpha"). + - "mix": `value (label)` (example: "Alpha (alpha)"). + + Simply set the + ``FOBI_FORM_ELEMENT_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. + +For example: + +.. code-block:: text + + 1 + 2 + alpha, Alpha + beta, Beta + omega + +The following HTML would be made of: + +.. code-block:: html + + + + +fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects +----------------------------------------------------------------------- +A ``Fobi`` Select Multiple Model Objects form field plugin. Makes use of the +``django.forms.models.ModelMultipleChoiceField`` and +``django.forms.widgets.SelectMultiple``. + +Installation +~~~~~~~~~~~~ +(1) Add + ``fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Make sure to take a look at + ``fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects.defaults.IGNORED_MODELS``. + If necessary, override it in your `settings` as shown in the example below: + + .. code-block:: python + + FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MODEL_OBJECTS_IGNORED_MODELS = [ + 'auth.User', + 'auth.Group', + ] + +(5) By default, the submitted form value of `select_multiple_model_objects` + elements is `app_label.model_name.object_pk.object_repr`. However, that + part of the behaviour has been made configurable. You can choose between + the following options: + + .. code-block:: text + + - "val": `app_label.model_name.object_pk.object_repr`. + - "repr": `object_repr` (uses the ``__unicode__`` method of the model). + - "mix" (default): `app_label.model_name.object_pk.object_repr`. + + Simply set the + ``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MODEL_OBJECTS_SUBMIT_VALUE_AS`` assign + one of the following values: "val", "repr" or "mix" to get the desired + behaviour. + + +fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects +---------------------------------------------------------------------------- +A ``Fobi`` Select Multiple MPTT Model Objects form field plugin. Makes use of +the ``mptt.forms.TreeNodeMultipleChoiceField`` and +``django.forms.widgets.SelectMultiple``. + +Installation +~~~~~~~~~~~~ +Install `django-mptt` +##################### +Taken from django-mptt `Getting started +`_. + +1. Download ``django-mptt`` using pip by running: + +.. code-block:: sh + + pip install django-mptt + +2. Add ``mptt`` to the ``INSTALLED_APPS`` in your ``settings.py``. + +Install `select_multiple_mptt_model_objects` plugin +################################################### +(1) Add + ``fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'mptt', + 'fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Make sure to take a look at + ``fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects.defaults.IGNORED_MODELS``. + If necessary, override it in your `settings` as shown in the example below: + + .. code-block:: python + + FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MPTT_MODEL_OBJECTS_IGNORED_MODELS = [ + 'auth.User', + 'auth.Group', + ] + +(5) By default, the submitted form value of `select_multiple_mptt_model_objects` + elements is `app_label.model_name.object_pk.object_repr`. However, that part + of the behaviour has been made configurable. You can choose between the + following options: + + .. code-block:: text + + - "val": `app_label.model_name.object_pk.object_repr`. + - "repr": `object_repr` (uses the ``__unicode__`` method of the model). + - "mix" (default): `app_label.model_name.object_pk.object_repr`. + + Simply set the + ``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MPTT_MODEL_OBJECTS_SUBMIT_VALUE_AS`` + assign one of the following values: "val", "repr" or "mix" to get the + desired behaviour. + + +fobi.contrib.plugins.form_elements.fields.select_multiple_with_max +------------------------------------------------------------------ +A ``Fobi`` Select Multiple form field plugin with max choices. Makes use of +the ``django.forms.widgets.SelectMultiple``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.select_multiple_with_max`` + to the ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.select_multiple_with_max', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) By default, the submitted form value of `select_multiple_with_max` + 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): + + .. code-block:: python + + [ + ('alpha', 'Alpha'), + ('beta', 'Beta'), + ('gamma', 'Gamma'), + ] + + .. code-block:: text + + - "val": `value` (example: "alpha"). + - "repr" (default): `label` (example: "Alpha"). + - "mix": `value (label)` (example: "Alpha (alpha)"). + + Simply set the + ``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_WITH_MAX_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. If you enter an integer in +the 'max_choices' field, the user can choose only or less choices. + +For example: + +.. code-block:: text + + 1 + 2 + alpha, Alpha + beta, Beta + omega + +The following HTML would be made of: + +.. code-block:: html + + + + +fobi.contrib.plugins.form_elements.fields.slider +------------------------------------------------ +A ``Fobi`` Percentage form field plugin. Makes use of the +``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.slider`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.slider', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Ranges are specified within the given min/max values. The default values + are: + + .. code-block:: text + + - INITIAL: 50 + - INITIAL_MAX_VALUE: 100 + - INITIAL_MIN_VALUE: 0 + - MIN_VALUE: 0 + - MAX_VALUE: 100 + - STEP: 1 + + However, you can override each of them in the settings of your project by + prefixing correspondent names with `FOBI_FORM_ELEMENT_SLIDER_`: + + .. code-block:: text + + - FOBI_FORM_ELEMENT_SLIDER_INITIAL + - FOBI_FORM_ELEMENT_SLIDER_INITIAL_MAX_VALUE + - FOBI_FORM_ELEMENT_SLIDER_INITIAL_MIN_VALUE + - FOBI_FORM_ELEMENT_SLIDER_MIN_VALUE + - FOBI_FORM_ELEMENT_SLIDER_MAX_VALUE + - FOBI_FORM_ELEMENT_SLIDER_STEP + + +fobi.contrib.plugins.form_elements.fields.text +---------------------------------------------- +A ``Fobi`` Text form field plugin. Makes use of the +``django.forms.fields.CharField`` and ``django.forms.widgets.TextInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.text`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.text', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.textarea +-------------------------------------------------- +A ``Fobi`` Textarea form field plugin. Makes use of the +``django.forms.fields.CharField`` and ``django.forms.widgets.Textarea``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.textarea`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.textarea', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.time +---------------------------------------------- +A ``Fobi`` DateTime form field plugin. Makes use of the +``django.forms.fields.TimeField`` and +``django.forms.widgets.TextInput``. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.time`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.time', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.fields.url +--------------------------------------------- +A ``Fobi`` URL form field plugin. Makes use of the +``django.forms.fields.URLField`` and ``django.forms.widgets.URLInput`` falling +back to ``django.forms.widgets.TextInput`` for older Django versions. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.fields.url`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.fields.url', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.security.captcha +--------------------------------------------------- +A `CAPTCHA `_ form field plugin. Makes +use of the `django-simple-captcha +`_. + +Prerequisites +~~~~~~~~~~~~~ +You will need ``libfreetype6``, otherwise ``django-captcha`` won't work. + +.. code-block:: sh + + sudo apt-get install libfreetype6-dev + +Installation +~~~~~~~~~~~~ +Install `django-simple-captcha` +############################### +Taken from django-simple-captcha `installation instructions +`_. + +(1) Download ``django-simple-captcha`` using pip by running: + + .. code-block:: sh + + pip install django-simple-captcha + +(2) Add ``captcha`` to the ``INSTALLED_APPS`` in your ``settings.py``. + +(3) Run ``python manage.py syncdb`` (or ``python manage.py migrate`` if you are + managing database migrations via South) to create the required database + tables. + +(4) Add an entry to your ``urls.py``: + + .. code-block:: python + + urlpatterns += [ + url(r'^captcha/', include('captcha.urls')), + ] + +Install `fobi` Captcha plugin +############################# +(1) Add ``fobi.contrib.plugins.form_elements.security.captcha`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.security.captcha', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +Troubleshooting and usage limitations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In combination with other captcha solutions +########################################### +At the moment, you can't use both ``CAPTCHA`` +(fobi.contrib.plugins.form_elements.security.captcha) and ``ReCAPTCHA`` +(fobi.contrib.plugins.form_elements.security.recaptcha) plugins alongside due +to app name collision of the ``django-simple-captcha`` and ``django-recaptcha`` +packages. That limitation is likely to be solved in future in the +``django-recaptcha`` package. Until then, you should choose either one or +another, but not both on the same time. + +Usage +~~~~~ +Note, that unlike most of the other form element plugins, default +value for the ``required`` attribute is True, which makes the Captcha +obligatory. Although you could still set it to False, it does not make +much sense to do so. + + +fobi.contrib.plugins.form_elements.security.honeypot +---------------------------------------------------- +A `Honeypot `_ +form field plugin. Just another anti-spam technique. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.security.honeypot`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.security.honeypot', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_elements.security.recaptcha +----------------------------------------------------- +A `ReCAPTCHA `_ form field plugin. +Makes use of the `django-recaptcha +`_. + +Installation +~~~~~~~~~~~~ +Install `django-recaptcha` +########################## +(1) Download ``django-recaptcha`` using pip by running: + + .. code-block:: sh + + pip install django-recaptcha + +(2) Add ``captcha`` to the ``INSTALLED_APPS`` in your ``settings.py``. + +(3) Run ``python manage.py syncdb`` (or ``python manage.py migrate`` if you are + managing database migrations via South) to create the required database + tables. + +Install `fobi` ReCAPTCHA plugin +############################### +(1) Add ``fobi.contrib.plugins.form_elements.security.recaptcha`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.security.recaptcha', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + +(4) Specify the following ReCAPTCHA credentials in your settings. + + .. code-block:: text + + - ``RECAPTCHA_PUBLIC_KEY`` + - ``RECAPTCHA_PRIVATE_KEY`` + +Troubleshooting and usage limitations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In combination with other captcha solutions +########################################### +At the moment, you can't use both ``CAPTCHA`` +(fobi.contrib.plugins.form_elements.security.captcha) and ``ReCAPTCHA`` +(fobi.contrib.plugins.form_elements.security.recaptcha) plugins alongside due +to app name collision of the ``django-simple-captcha`` and ``django-recaptcha`` +packages. That limitation is likely to be solved in future in the +``django-recaptcha`` package. Until then, you should choose either one or +another, but not both on the same time. + +If you happen to see errors like "Input error: k: Format of site key was +invalid", make sure to have defined (and filled in properly) the +``RECAPTCHA_PUBLIC_KEY`` and ``RECAPTCHA_PRIVATE_KEY`` in your settnings.py. +See the `following `_ +thread for more information. + +Usage +~~~~~ +Note, that unlike most of the other form element plugins, default +value for the ``required`` attribute is True, which makes the ReCaptcha +obligatory. Although you could still set it to False, it does not make +much sense to do so. + + +fobi.contrib.plugins.form_elements.test.dummy +--------------------------------------------- +A ``Fobi`` Dummy form element plugin. Created for testing purposes. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_elements.test.dummy`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_elements.test.dummy', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_handlers.db_store +------------------------------------------- +A ``Fobi`` Database Store form-/wizard- handler plugin. Saves submitted form +data into the ``SavedFormDataEntry``/``SavedFormWizardDataEntry`` models. + +Dependencies +~~~~~~~~~~~~ +The `xlwt `_ package is required +(optional) for XLS export. If not present, export format falls back +to CSV. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_handlers.db_store`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_handlers.db_store', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./manage.py migrate + + ./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. + +(4) Add db_store form handler plugin URLs to the urls.py of your project. + + .. code-block:: python + + urlpatterns = [ + # DB Store plugin URLs + url(r'^fobi/plugins/form-handlers/db-store/', + include('fobi.contrib.plugins.form_handlers.db_store.urls')), + ] + + For form wizards do: + + .. code-block:: python + + urlpatterns = [ + # DB Store plugin URLs + url(r'^fobi/plugins/form-wizard-handlers/db-store/', + include('fobi.contrib.plugins.form_handlers.db_store.urls.' + 'form_wizard_handlers')), + ] + + +fobi.contrib.plugins.form_handlers.http_repost +---------------------------------------------- +A ``Fobi`` HTTP Repost form handler plugin. Submits the form +data as is to the given endpoint. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_handlers.http_repost`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_handlers.http_repost', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +fobi.contrib.plugins.form_handlers.mail +--------------------------------------- +A ``Fobi`` Mail form handler plugin. Submits the form +data by email to the specified email address. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.plugins.form_handlers.mail`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.plugins.form_handlers.mail', + # ... + ) + +(2) In the terminal type: + + .. code-block:: sh + + ./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. + + +mailchimp_importer +------------------ +A ``django-fobi`` integration with MailChimp. + +This plugin makes it possible to import a form from a MailChimp list. A typical +list URL would be `this `_. In the +listing you would see list names and `Stats` at the right corner. If you click +on it you would see the `Settings` link. Follow it and scroll to the bottom for +the unique id for your list. Now, if you have been successfully authenticated +to the MailChimp API using your API_KEY, you could call the `lists.merge_vars` +method for getting the form. API_KEY could be obtained from the MailChimp +in the `Account API `_. + +For additional information on MailChimp import see the following `article +`_. + +Prerequisites +~~~~~~~~~~~~~ +Python wrapper for the Mailchimp: + +.. code-block:: sh + + pip install mailchimp + +If you are using Django 1.8 or greater, you would need `django-formtools` +package as well: + +.. code-block:: sh + + pip install django-formtools + +Installation +~~~~~~~~~~~~ +your_project/settings.py +######################## +.. code-block:: python + + INSTALLED_APPS = list(INSTALLED_APPS) + INSTALLED_APPS += [ + 'fobi.contrib.plugins.form_importers.mailchimp_importer', + ] + +How it works +~~~~~~~~~~~~ +Assuming that you have configured the `mailchimp_importer` plugin properly and +have the Django running locally on port 8000, accessing the following URL would +bring you to the MailChimp form import wizard. + +- http://localhost:8000/en/fobi/forms/importer/mailchimp/ + +On the first step you would be asked to provide your API_KEY, which is used +to authenticate to the MailChimp in order to fetch your list- and form- +information. The key isn't stored/saved/remembered. Next time you want to +import a form from the same account, you would have to provide it again. + +Development status +~~~~~~~~~~~~~~~~~~ +This part of code is alpha, which means it experimental and needs improvements. + +See the `TODOS `_ +for the full list of planned-, pending- in-development- or to-be-implemented +features. + +If you want to improve it or did make it working, please, make a pull request. + + +fobi.contrib.themes.bootstrap3 +------------------------------ +A ``django-fobi`` Bootstrap 3 theme. Based on the ??? template. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.themes.bootstrap3`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.themes.bootstrap3', + # ... + ) + +(2) Specify ``bootstrap3`` as a default theme in your ``settings.py``: + + .. code-block:: python + + FOBI_DEFAULT_THEME = 'bootstrap3' + + +fobi.contrib.themes.djangocms_admin_style_theme +----------------------------------------------- +A ``django-fobi`` theme in a style of ``djangocms-admin-style`` admin. +Relies on ``djangocms-admin-style`` package and some jQuery UI only. + +jQuery UI "Smoothness" theme comes from `here `_. + +Installation +~~~~~~~~~~~~ +Install `djangocms-admin-style` +############################### +See the original `installation instructions +`_. + +(1) Install the ``djangocms-admin-style`` package. + + .. code-block:: sh + + pip install djangocms-admin-style + +(2) Add ``djangocms_admin_style`` to your ``INSTALLED_APPS`` just before + ``django.contrib.admin``. + +Install `fobi.contrib.themes.djangocms_admin_style_theme` theme +############################################################### +(1) Add ``fobi.contrib.themes.djangocms_admin_style_theme`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.themes.djangocms_admin_style_theme', + # ... + ) + +(2) Specify ``djangocms_admin_style_theme`` as a default theme in your + ``settings.py``: + + .. code-block:: python + + FOBI_DEFAULT_THEME = 'djangocms_admin_style_theme' + + +fobi.contrib.themes.foundation5 +------------------------------- +A ``django-fobi`` Foundation 5 theme. Based on the ??? template, but +entire JS and CSS are taken from Foundation 5 version 5.4.0. The +`following `_ icon set +was used. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.themes.foundation5`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.themes.foundation5', + # ... + ) + +(2) Specify ``foundation5`` as a default theme in your ``settings.py``: + + .. code-block:: python + + FOBI_DEFAULT_THEME = 'foundation5' + + +fobi.contrib.themes.simple +-------------------------- +A ``django-fobi`` theme in a style of Django admin. Relies on Django-admin +and some jQuery UI only. + +jQuery UI "Django" theme comes from `here +`_. + +Installation +~~~~~~~~~~~~ +(1) Add ``fobi.contrib.themes.simple`` to the + ``INSTALLED_APPS`` in your ``settings.py``. + + .. code-block:: python + + INSTALLED_APPS = ( + # ... + 'fobi.contrib.themes.simple', + # ... + ) + +(2) Specify ``simple`` as a default theme in your ``settings.py``: + + .. code-block:: python + + FOBI_DEFAULT_THEME = 'simple' + + diff --git a/docs/licenses.rst b/docs/licenses.rst new file mode 100644 index 00000000..ff12c33f --- /dev/null +++ b/docs/licenses.rst @@ -0,0 +1,182 @@ +======== +Licenses +======== +Below information about third-party packages used in the project is presented. + +Bootstrap3 +========== +http://getbootstrap.com/ + +Licensing information: + +- Apache license 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + +Bootstrap 3 DateTime picker +=========================== +http://eonasdan.github.io/bootstrap-datetimepicker/ + +- MIT (http://opensource.org/licenses/mit-license.html) + +bootstrap-slider +================ +https://github.com/seiyria/bootstrap-slider + +- MIT (http://opensource.org/licenses/mit-license.html) + +django-autoslug +=============== +https://bitbucket.org/neithere/django-autoslug + +Licensing information: + +- LGPL 3 (https://www.gnu.org/licenses/lgpl.html) + +django-formtools +================ +https://github.com/django/django-formtools + +Licensing information: + +- BSD (http://opensource.org/licenses/BSD-3-Clause) + +django-nine +=========== +https://github.com/barseghyanartur/django-nine + +Licensing information: + +- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) +- LGPL 2.1 (https://www.gnu.org/licenses/lgpl-2.1.html) + +django-nonefield +================ +https://github.com/barseghyanartur/django-nonefield + +Licensing information: + +- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) +- LGPL 2.1 (https://www.gnu.org/licenses/lgpl-2.1.html) + +easy-thumbnails +=============== +https://github.com/SmileyChris/easy-thumbnails + +Licensing information: + +- BSD (http://opensource.org/licenses/BSD-3-Clause) + +Font-awesome +============ +http://fontawesome.io/ + +Licensing information: + +- http://fontawesome.io/license/ +- SIL OFL 1.1 (http://scripts.sil.org/OFL) +- MIT (http://opensource.org/licenses/mit-license.html) + +Foundation 5 +============ +http://foundation.zurb.com/ + +Licensing information: + +- MIT (http://opensource.org/licenses/mit-license.html) + +Foundation 5 DateTime picker +============================ +https://github.com/aliibrahim/foundation-datetimepicker-rails + +Licensing information: + +- MIT (http://opensource.org/licenses/mit-license.html) + +jQuery Colorbox +=============== +http://www.jacklmoore.com/colorbox/ + +Licensing information: + +- MIT (http://www.opensource.org/licenses/mit-license.php) + +jQuery +====== +https://jquery.org + +Licensing information: + +- https://jquery.org/license/ +- MIT (http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) + +jQueryUI +======== +http://jqueryui.com/ + +Licensing information: + +- MIT (https://github.com/jquery/jquery-ui/blob/master/MIT-LICENSE.txt) + +jQuery-Slugify-Plugin +===================== +https://github.com/pmcelhaney/jQuery-Slugify-Plugin + +Licensing information: + +- BSD (https://github.com/pmcelhaney/jQuery-Slugify-Plugin/blob/master/LICENSE). + +moment.js +========= +http://momentjs.com/ + +Licensing information: + +- MIT (http://opensource.org/licenses/mit-license.html) + +ordereddict +=========== +https://pypi.python.org/pypi/ordereddict + +Licensing information: + +- MIT (http://opensource.org/licenses/mit-license.html) + +Pillow +====== +http://python-pillow.github.io/ + +Licensing information: + +- Python Imaging Library license (http://www.pythonware.com/products/pil/) + +Requests +======== +https://python-requests.org + +Licensing information: + +- MIT (http://opensource.org/licenses/mit-license.html) + +Six +=== +https://bitbucket.org/gutworth/six/ + +Licensing information: + +- Apache 2.0 (http://opensource.org/licenses/Apache-2.0) + +Unidecode +========= +https://pypi.python.org/pypi/Unidecode + +Licensing information: + +- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) + +vishap +====== +https://pypi.python.org/pypi/vishap + +Licensing information: + +- GPL 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) +- LGPL 2.1 (https://www.gnu.org/licenses/lgpl-2.1.html) diff --git a/docs/screenshots.rst.distrib b/docs/screenshots.rst.distrib index c72bd5de..6e48cb14 100644 --- a/docs/screenshots.rst.distrib +++ b/docs/screenshots.rst.distrib @@ -20,7 +20,7 @@ Create a form View/edit form ~~~~~~~~~~~~~~ Form elements -+++++++++++++ +############# .. [1.3] Edit form - form elements tab active, no elements yet .. image:: _static/bootstrap3/03_edit_form_-_form_elements_tab_active_-_no_elements_yet.png @@ -42,7 +42,7 @@ Form elements :scale: 80 % Form handlers -+++++++++++++ +############# .. [1.7] Edit form - form handlers tab active, no handlers yet diff --git a/docs/submodules.rst.distrib b/docs/submodules.rst.distrib new file mode 100644 index 00000000..82837bea --- /dev/null +++ b/docs/submodules.rst.distrib @@ -0,0 +1,4 @@ +(Sub)modules +============ +Some additional documentation on ``django-fobi`` sub-modules are listed +below. diff --git a/scripts/build_docs.sh b/scripts/build_docs.sh index 020b17da..58c42581 100755 --- a/scripts/build_docs.sh +++ b/scripts/build_docs.sh @@ -1,7 +1,285 @@ #./scripts/uninstall.sh #./scripts/install.sh -cat README.rst docs/screenshots.rst.distrib docs/documentation.rst.distrib > docs/index.rst +cat README.rst \ + docs/empty.rst.distrib \ + \ + docs/screenshots.rst.distrib \ + docs/empty.rst.distrib \ + \ + docs/documentation.rst.distrib \ + docs/empty.rst.distrib \ + \ + docs/submodules.rst.distrib \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/djangocms_integration/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/content/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/boolean/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/checkbox_select_multiple/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/date/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/date_drop_down/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/datetime/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/decimal/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/email/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/file/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/float/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/hidden/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/input/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/integer/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/ip_address/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/null_boolean/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/password/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/radio/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/range_select/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/regex/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/select/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/select_multiple/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/select_multiple_with_max/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/slider/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/slug/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/text/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/textarea/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/time/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_elements/fields/url/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_handlers/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_handlers/db_store/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_handlers/http_repost/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/drf_integration/form_handlers/mail/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/feincms_integration/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/apps/mezzanine_integration/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/content/content_image/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/content/content_image_url/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/content/content_text/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/content/content_video/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/boolean/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/checkbox_select_multiple/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/date/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/date_drop_down/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/datetime/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/decimal/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/email/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/file/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/float/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/hidden/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/input/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/integer/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/ip_address/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/null_boolean/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/password/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/radio/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/range_select/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/regex/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/select/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/select_model_object/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/select_mptt_model_object/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/select_multiple/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/select_multiple_model_objects/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/select_multiple_mptt_model_objects/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/select_multiple_with_max/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/slider/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/text/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/textarea/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/time/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/fields/url/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/security/captcha/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/security/honeypot/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/security/recaptcha/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_elements/test/dummy/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_handlers/db_store/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_handlers/http_repost/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_handlers/mail/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/plugins/form_importers/mailchimp_importer/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/themes/bootstrap3/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/themes/djangocms_admin_style_theme/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/themes/foundation5/README.rst \ + docs/empty.rst.distrib \ + \ + src/fobi/contrib/themes/simple/README.rst \ + docs/empty.rst.distrib \ + \ + > docs/index.rst cat QUICK_START.rst > docs/quickstart.rst +cat CHANGELOG.rst > docs/changelog.rst +cat LICENSES.rst > docs/licenses.rst sphinx-build -n -a -b html docs builddocs #sphinx-build -n -a -b pdf docs builddocs cd builddocs && zip -r ../builddocs.zip . -x ".*" && cd .. diff --git a/scripts/rebuild_docs.sh b/scripts/rebuild_docs.sh index 8c611b3c..29abaa69 100755 --- a/scripts/rebuild_docs.sh +++ b/scripts/rebuild_docs.sh @@ -1,5 +1,5 @@ -./scripts/uninstall.sh -./scripts/install.sh +#./scripts/uninstall.sh +#./scripts/install.sh rm docs/*.rst rm -rf builddocs/ sphinx-apidoc src/fobi --full -o docs -H 'django-fobi' -A 'Artur Barseghyan ' -V '0.1' -f -d 20 diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/README.rst b/src/fobi/contrib/apps/drf_integration/form_elements/README.rst new file mode 100644 index 00000000..712a99fb --- /dev/null +++ b/src/fobi/contrib/apps/drf_integration/form_elements/README.rst @@ -0,0 +1,2 @@ +Form elements +------------- diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/README.rst b/src/fobi/contrib/apps/drf_integration/form_elements/content/README.rst new file mode 100644 index 00000000..6c9d1784 --- /dev/null +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/README.rst @@ -0,0 +1,3 @@ +Content form element +~~~~~~~~~~~~~~~~~~~~ +Presentational form elements for ``drf_integration``. diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/README.rst b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/README.rst index 5d497b47..c7cedd9c 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/README.rst +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/README.rst @@ -1,19 +1,19 @@ -fobi.contrib.apps.drf_integration.form_elements.fields.content_image -#################################################################### +fobi.contrib.apps.drf_integration.form_elements.content.content_image +##################################################################### A ``django-fobi`` ContentImage plugin for integration with ``Django REST framework``. Makes use of the ``fobi.contrib.apps.drf_integration.fields.ContentImage``. Installation ^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.content_image`` +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_image`` to the ``INSTALLED_APPS`` in your ``settings.py``. .. code-block:: python INSTALLED_APPS = ( # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.content_image', + 'fobi.contrib.apps.drf_integration.form_elements.content.content_image', # ... ) diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/README.rst b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/README.rst index 6f0a5468..d9cbb5b2 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/README.rst +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/README.rst @@ -1,19 +1,19 @@ -fobi.contrib.apps.drf_integration.form_elements.fields.content_image_url -######################################################################## +fobi.contrib.apps.drf_integration.form_elements.content.content_image_url +######################################################################### A ``django-fobi`` ContentImageURL plugin for integration with ``Django REST framework``. Makes use of the ``fobi.contrib.apps.drf_integration.fields.ContentImage``. Installation ^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.content_image_url`` +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_image_url`` to the ``INSTALLED_APPS`` in your ``settings.py``. .. code-block:: python INSTALLED_APPS = ( # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.content_image_url', + 'fobi.contrib.apps.drf_integration.form_elements.content.content_image_url', # ... ) diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/README.rst b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/README.rst index ca6a0394..a61f30e5 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/README.rst +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/README.rst @@ -1,19 +1,19 @@ -fobi.contrib.apps.drf_integration.form_elements.fields.content_text -################################################################### +fobi.contrib.apps.drf_integration.form_elements.content.content_text +#################################################################### A ``django-fobi`` ContentText plugin for integration with ``Django REST framework``. Makes use of the ``fobi.contrib.apps.drf_integration.fields.ContentText``. Installation ^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.content_text`` +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_text`` to the ``INSTALLED_APPS`` in your ``settings.py``. .. code-block:: python INSTALLED_APPS = ( # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.content_text', + 'fobi.contrib.apps.drf_integration.form_elements.content.content_text', # ... ) diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/README.rst b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/README.rst index 9a5bfc62..427705ce 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/README.rst +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/README.rst @@ -1,19 +1,19 @@ -fobi.contrib.apps.drf_integration.form_elements.fields.content_video -#################################################################### +fobi.contrib.apps.drf_integration.form_elements.content.content_video +##################################################################### A ``django-fobi`` ContentVideo plugin for integration with ``Django REST framework``. Makes use of the ``fobi.contrib.apps.drf_integration.fields.ContentVideo``. Installation ^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.content_video`` +1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_video`` to the ``INSTALLED_APPS`` in your ``settings.py``. .. code-block:: python INSTALLED_APPS = ( # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.content_video', + 'fobi.contrib.apps.drf_integration.form_elements.content.content_video', # ... ) diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/README.rst b/src/fobi/contrib/apps/drf_integration/form_elements/fields/README.rst new file mode 100644 index 00000000..1f6f76a4 --- /dev/null +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/README.rst @@ -0,0 +1,3 @@ +Fields +~~~~~~ +Form fields for ``drf_integration``. diff --git a/src/fobi/contrib/apps/drf_integration/form_handlers/README.rst b/src/fobi/contrib/apps/drf_integration/form_handlers/README.rst new file mode 100644 index 00000000..1b540259 --- /dev/null +++ b/src/fobi/contrib/apps/drf_integration/form_handlers/README.rst @@ -0,0 +1,3 @@ +Form handlers +------------- +Form handlers for ``drf_integration``. diff --git a/src/fobi/contrib/apps/drf_integration/form_handlers/db_store/README.rst b/src/fobi/contrib/apps/drf_integration/form_handlers/db_store/README.rst index ed2f4e7d..4e9654a6 100644 --- a/src/fobi/contrib/apps/drf_integration/form_handlers/db_store/README.rst +++ b/src/fobi/contrib/apps/drf_integration/form_handlers/db_store/README.rst @@ -1,11 +1,11 @@ fobi.contrib.apps.drf_integration.form_handlers.db_store -######################################################## +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A ``django-fobi`` Mail form handler plugin for integration with ``Django REST framework``. Saves submitted form data into the ``SavedFormDataEntry`` model. Installation -^^^^^^^^^^^^ +############ 1. Add ``fobi.contrib.apps.drf_integration.form_handlers.db_store`` to the ``INSTALLED_APPS`` in your ``settings.py``. diff --git a/src/fobi/contrib/apps/drf_integration/form_handlers/http_repost/README.rst b/src/fobi/contrib/apps/drf_integration/form_handlers/http_repost/README.rst index 83fb1d27..f0417749 100644 --- a/src/fobi/contrib/apps/drf_integration/form_handlers/http_repost/README.rst +++ b/src/fobi/contrib/apps/drf_integration/form_handlers/http_repost/README.rst @@ -1,10 +1,10 @@ fobi.contrib.apps.drf_integration.form_handlers.http_repost -########################################################### +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A ``django-fobi`` HTTP repost form handler plugin for integration with ``Django REST framework``. Submits the form to another endpoint specified. Installation -^^^^^^^^^^^^ +############ 1. Add ``fobi.contrib.apps.drf_integration.form_handlers.http_respost`` to the ``INSTALLED_APPS`` in your ``settings.py``. diff --git a/src/fobi/contrib/apps/drf_integration/form_handlers/mail/README.rst b/src/fobi/contrib/apps/drf_integration/form_handlers/mail/README.rst index e9c27613..e5352b25 100644 --- a/src/fobi/contrib/apps/drf_integration/form_handlers/mail/README.rst +++ b/src/fobi/contrib/apps/drf_integration/form_handlers/mail/README.rst @@ -1,11 +1,11 @@ fobi.contrib.apps.drf_integration.form_handlers.mail -#################################################### +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A ``django-fobi`` Mail form handler plugin for integration with ``Django REST framework``. Submits the form data by email to the specified email address. Installation -^^^^^^^^^^^^ +############ 1. Add ``fobi.contrib.apps.drf_integration.form_handlers.mail`` to the ``INSTALLED_APPS`` in your ``settings.py``. From bba966892634c0c91907ad566beafbebdab33df1 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 1 Jun 2017 01:18:59 +0200 Subject: [PATCH 3/4] prepare 0.11.12 --- CHANGELOG.rst | 7 + TODOS.rst | 3 + docs/index.rst | 4001 ----------------- setup.py | 2 +- src/fobi/__init__.py | 4 +- .../contrib/apps/drf_integration/TODOS.rst | 5 + src/fobi/contrib/apps/drf_integration/base.py | 3 +- .../contrib/apps/drf_integration/dynamic.py | 57 +- .../content/content_image/base.py | 12 +- .../content/content_image_url/base.py | 12 +- .../content/content_text/base.py | 13 +- .../content/content_video/base.py | 12 +- .../form_elements/fields/decimal/base.py | 10 +- .../form_elements/fields/email/base.py | 8 +- .../form_elements/fields/float/base.py | 7 +- .../form_elements/fields/input/base.py | 48 +- .../form_elements/fields/integer/base.py | 14 +- .../form_elements/fields/ip_address/base.py | 6 +- .../form_elements/fields/password/base.py | 6 +- .../form_elements/fields/regex/base.py | 7 +- .../form_elements/fields/slug/base.py | 6 +- .../form_elements/fields/text/base.py | 7 +- .../form_elements/fields/textarea/base.py | 6 +- .../form_elements/fields/url/base.py | 6 +- .../contrib/apps/drf_integration/metadata.py | 29 +- .../apps/drf_integration/serializers.py | 8 + .../contrib/apps/drf_integration/views.py | 5 +- src/fobi/tests/data.py | 11 +- 28 files changed, 259 insertions(+), 4056 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ae236e9c..f038ce09 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,13 @@ are used for versioning (schema follows below): 0.3.4 to 0.4). - All backwards incompatible changes are mentioned in this document. +0.11.12 +------- +2017-05-31 + +- Added a lot of field metadata to the OPTIONS call of ``drf_integration`` app. +- Appended a lot of sub-module README files to the main documentation. + 0.11.11 ------- 2017-05-29 diff --git a/TODOS.rst b/TODOS.rst index 9301f370..db585f47 100644 --- a/TODOS.rst +++ b/TODOS.rst @@ -81,6 +81,9 @@ Roadmap Uncategorised ------------- +- Somehow PyPy started to fail under Django 1.10 and 1.11 (invocation error), + so it must be some package incompatibility/installation problems. Find out + why. - Think of moving the translation strings from in stored-in=database level to lazily-translated level (so that in some plugins, for instance - in database translations happen lazily). For mail plugin that should not be the case, diff --git a/docs/index.rst b/docs/index.rst index 8d3e5743..3cf6119b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2368,8 +2368,6 @@ Author ====== Artur Barseghyan - - Screenshots =========== Bootstrap3 theme @@ -2504,8 +2502,6 @@ View/edit form .. image:: _static/simple/06_view_form.png :scale: 80 % - - Documentation ============= Contents: @@ -2525,4000 +2521,3 @@ Indices and tables * :ref:`modindex` * :ref:`search` - - -(Sub)modules -============ -Some additional documentation on ``django-fobi`` sub-modules are listed -below. - - -fobi.contrib.apps.djangocms_integration ---------------------------------------- -A ``django-fobi`` integration with DjangoCMS. - -Prerequisites -~~~~~~~~~~~~~ -Has been tested with DjangoCMS 2.4.3 and 3.0.6 only. Might work on earlier (or -later) versions as well. - -Installation -~~~~~~~~~~~~ -Versions -######## -See the requirements files: - -- `DjangoCMS 2.4.3 requirements - `_. -- `DjangoCMS 3.0.6 requirements - `_. - -your_project/settings.py -######################## -See the example settings files: - -- `DjangoCMS 2.4.3 settings - `_. -- `DjangoCMS 3.0.6 settings - `_. - -.. code-block:: python - - INSTALLED_APPS = list(INSTALLED_APPS) - INSTALLED_APPS += [ - 'cms', # FeinCMS - - 'fobi.contrib.apps.djangocms_integration', # Fobi DjangoCMS app - ] - -Information for developers -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Templates for DjangoCMS -####################### -Django-CMS templates are quite specific and in some aspects are not 100% -compatible with built-in themes (due to the fact that DjangoCMS intensively -makes use of ``django-sekizai`` which isn't used in the generic templates). - -That does not anyhow affect the core ``fobi`` and the built-in themes, -although you can't magically reuse built-in ``fobi`` themes with Django-CMS -(as it's done for `FeinCMS page templates -`_). - -You would have to make custom page templates from scratch (or based on a -copy of the desired bundled template). See how I did it for all bundled themes -`here -`_: - -- `Bootstrap 3 - `_ -- `Foundation 5 - `_ -- `Simple - `_ - -Template rendering -################## -The embed DjangoCMS widget is rendered with use of two theme templates: - -- ``view_embed_form_entry_ajax_template``: Used for rendering the form. -- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form - sent event. - -Using custom templates for rendering the widget -############################################### -In the widget, you can specify a template which you want to be used for -rendering the form or the form-sent event. - -Example: - -.. code-block:: python - - FOBI_DJANGOCMS_INTEGRATION_FORM_TEMPLATE_CHOICES = ( - ("yourapp/custom_view_embed_form_v1.html", - "Custom embed form view template #1"), - ("yourapp/custom_view_embed_form_v2.html", - "Custom embed form view template #2"), - ) - -Same goes for form-sent templates. - -.. code-block:: python - - FOBI_DJANGOCMS_INTEGRATION_SUCCESS_PAGE_TEMPLATE_CHOICES = ( - ("yourapp/custom_embed_form_submitted_v1.html", - "Custom form-sent template #1"), - ("yourapp/custom_embed_form_submitted_v2.html", - "Custom form-sent template #2"), - ) - -Registering a template in the ``FORM_TEMPLATE_CHOICES`` makes it available -for all the themes. If you rather want to use different custom templates -for different themes, use the ``FOBI_CUSTOM_THEME_DATA`` as shown in the -example below. - -.. code-block:: python - - FOBI_CUSTOM_THEME_DATA = { - 'bootstrap3': { - 'djangocms_integration': { - 'form_template_choices': [ - ('fobi/bootstrap3_extras/view_embed_form.html', - "Custom bootstrap3 embed form view template"), - ], - 'success_page_template_choices': [ - ('fobi/bootstrap3_extras/embed_form_submitted.html', - "Custom bootstrap3 embed form entry submitted template"), - ], - }, - }, - 'foundation5': { - 'djangocms_integration': { - 'form_template_choices': [ - ('fobi/foundation5_extras/view_embed_form.html', - "Custom foundation5 embed form view template"), - ], - 'success_page_template_choices': [ - ('fobi/foundation5_extras/embed_form_submitted.html', - "Custom foundation5 embed form entry submitted template"), - ], - }, - }, - } - -Usage -~~~~~ -The ``fobi.contrib.apps.djangocms_integration.models.FobiFormWidget`` consists -of the following fields: - -- Form: The form to be used. -- Form template name: Template to be used to render the embed form. -- Hide form title: If checked, no form title would be shown. -- Form title: Overrides the standard form title. -- Submit button text: Overrides the default submit button text. -- Success page template name: Template to be used to render the embed form-sent - event. -- Hide success page title: If checked, no form-sent title would be shown. -- Success page title: Overrides the form-sent title. -- Success page text: Overrides the form-sent text. - - -fobi.contrib.apps.drf_integration ---------------------------------- -A ``django-fobi`` integration with ``Django REST framework``. - -Supported actions are: - -- `LIST`_: List all the forms. -- `OPTIONS`_: Describe the given form. -- `PUT`_: Submit form data. - -Live demo -~~~~~~~~~ -Live demo is available on Heroku. - -- `The core `_ -- `Django REST framework integration `_ - -Supported fields -~~~~~~~~~~~~~~~~ -The following fields are supported. - -Content (presentational form elements) -###################################### -Unlike standard fields, ``content`` fields are purely presentational. -You're not supposed to make write actions on them (it won't work). Neither -will they be displayed in the browsable API (list/retrieve actions). However, -they will be listed in the options action call. All content fields are of type -"content". - -- content_image -- content_image_url -- content_text -- content_video - -Fields -###### -- boolean -- checkbox_select_multiple -- date -- date_drop_down -- datetime -- decimal -- email -- file -- float -- hidden (in terms of the Django REST framework - a read-only field) -- input (some sort of a copy of ``text`` plugin) -- integer -- ip_address -- null_boolean -- password (some sort of a copy of ``text`` plugin) -- radio -- range_select -- regex -- select -- select_multiple -- select_multiple_with_max -- slider (just a copy of range_select, for compatibility with main package) -- slug -- text -- textarea (some sort of a copy of ``text`` plugin) -- time -- url - -Not (yet) supported fields -~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following fields are not supported. Those marked with asterisk are planned -to be supported in the upcoming releases. - -- select_model_object -- select_mptt_model_object -- select_multiple_model_objects -- select_multiple_mptt_model_objects - -Implementation details -~~~~~~~~~~~~~~~~~~~~~~ -Each ``django-fobi`` plugin has its' own representative integration plugin -within ``fobi.contrib.aps.drf_integration`` package. - -Some of the plugins may seam to have zero-added-value and in fact they are. -For instance, DRF integration ``slider`` plugin is just an exact copy of the -``range_select`` plugin, created in order to provide exactly the same form -fields generated in the API. - -You should mention all the plugins you want to use explicitly in the -project settings. Thus, if you have used (included in the ``INSTALLED_APPS``) -the core plugins: - -- fobi.contrib.plugins.form_elements.fields.boolean -- fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple -- fobi.contrib.plugins.form_elements.fields.date -- fobi.contrib.plugins.form_elements.fields.date_drop_down -- fobi.contrib.plugins.form_elements.fields.datetime -- fobi.contrib.plugins.form_elements.fields.decimal -- fobi.contrib.plugins.form_elements.fields.email -- 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.input -- fobi.contrib.plugins.form_elements.fields.integer -- fobi.contrib.plugins.form_elements.fields.ip_address -- fobi.contrib.plugins.form_elements.fields.null_boolean -- fobi.contrib.plugins.form_elements.fields.password -- fobi.contrib.plugins.form_elements.fields.radio -- fobi.contrib.plugins.form_elements.fields.range_select -- fobi.contrib.plugins.form_elements.fields.regex -- fobi.contrib.plugins.form_elements.fields.select -- fobi.contrib.plugins.form_elements.fields.select_multiple -- fobi.contrib.plugins.form_elements.fields.select_multiple_with_max -- fobi.contrib.plugins.form_elements.fields.slider -- fobi.contrib.plugins.form_elements.fields.slug -- fobi.contrib.plugins.form_elements.fields.text -- fobi.contrib.plugins.form_elements.fields.textarea -- fobi.contrib.plugins.form_elements.fields.time -- fobi.contrib.plugins.form_elements.fields.url -- fobi.contrib.plugins.form_elements.content.content_image -- fobi.contrib.plugins.form_elements.content.content_image_url -- fobi.contrib.plugins.form_elements.content.content_text -- fobi.contrib.plugins.form_elements.content.content_video -- fobi.contrib.plugins.form_handlers.db_store -- fobi.contrib.plugins.form_handlers.http_repost -- fobi.contrib.plugins.form_handlers.mail - -You should include their correspondent Django REST framework implementations -in the ``INSTALLED_APPS`` as well: - -- fobi.contrib.apps.drf_integration.form_elements.fields.boolean -- fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple -- fobi.contrib.apps.drf_integration.form_elements.fields.date -- fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down -- fobi.contrib.apps.drf_integration.form_elements.fields.datetime -- fobi.contrib.apps.drf_integration.form_elements.fields.decimal -- fobi.contrib.apps.drf_integration.form_elements.fields.email -- fobi.contrib.apps.drf_integration.form_elements.fields.file -- fobi.contrib.apps.drf_integration.form_elements.fields.float -- fobi.contrib.apps.drf_integration.form_elements.fields.hidden -- fobi.contrib.apps.drf_integration.form_elements.fields.input -- fobi.contrib.apps.drf_integration.form_elements.fields.integer -- fobi.contrib.apps.drf_integration.form_elements.fields.ip_address -- fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean -- fobi.contrib.apps.drf_integration.form_elements.fields.password -- fobi.contrib.apps.drf_integration.form_elements.fields.radio -- fobi.contrib.apps.drf_integration.form_elements.fields.range_select -- fobi.contrib.apps.drf_integration.form_elements.fields.regex -- fobi.contrib.apps.drf_integration.form_elements.fields.select -- fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple -- fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_with_max -- fobi.contrib.apps.drf_integration.form_elements.fields.slider -- fobi.contrib.apps.drf_integration.form_elements.fields.slug -- fobi.contrib.apps.drf_integration.form_elements.fields.text -- fobi.contrib.apps.drf_integration.form_elements.fields.textarea -- fobi.contrib.apps.drf_integration.form_elements.fields.time -- fobi.contrib.apps.drf_integration.form_elements.fields.url -- fobi.contrib.apps.drf_integration.form_elements.content.content_image -- fobi.contrib.apps.drf_integration.form_elements.content.content_image_url -- fobi.contrib.apps.drf_integration.form_elements.content.content_text -- fobi.contrib.apps.drf_integration.form_elements.content.content_video -- fobi.contrib.apps.drf_integration.form_handlers.db_store -- fobi.contrib.apps.drf_integration.form_handlers.http_repost -- fobi.contrib.apps.drf_integration.form_handlers.mail - -Installation -~~~~~~~~~~~~ -Versions -######## -Was made with ``djangorestframework`` 3.6.2. May work on earlier versions, -although not guaranteed. - -See the `requirements file -`_. - -your_project/settings.py -######################## -See the `example settings file -`_. - -.. code-block:: python - - INSTALLED_APPS = list(INSTALLED_APPS) - INSTALLED_APPS += [ - # ... - # Here should come a list of form element plugins of the core - # package, followed by the list of form handler plugins of the core - # package, followed by the list of themes of the core package and - # all other apps that do matter. - # ... - 'rest_framework', # Django REST framework - 'fobi.contrib.apps.drf_integration', # DRF integration app - - # DRF integration form element plugins - fields - 'fobi.contrib.apps.drf_integration.form_elements.fields.boolean', - 'fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple', - 'fobi.contrib.apps.drf_integration.form_elements.fields.date', - 'fobi.contrib.apps.drf_integration.form_elements.fields.datetime', - 'fobi.contrib.apps.drf_integration.form_elements.fields.decimal', - 'fobi.contrib.apps.drf_integration.form_elements.fields.email', - 'fobi.contrib.apps.drf_integration.form_elements.fields.file', - 'fobi.contrib.apps.drf_integration.form_elements.fields.float', - 'fobi.contrib.apps.drf_integration.form_elements.fields.hidden', - 'fobi.contrib.apps.drf_integration.form_elements.fields.input', - 'fobi.contrib.apps.drf_integration.form_elements.fields.integer', - 'fobi.contrib.apps.drf_integration.form_elements.fields.ip_address', - 'fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean', - 'fobi.contrib.apps.drf_integration.form_elements.fields.password', - 'fobi.contrib.apps.drf_integration.form_elements.fields.radio', - 'fobi.contrib.apps.drf_integration.form_elements.fields.range_select', - 'fobi.contrib.apps.drf_integration.form_elements.fields.regex', - 'fobi.contrib.apps.drf_integration.form_elements.fields.select', - 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple', - 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_with_max', - 'fobi.contrib.apps.drf_integration.form_elements.fields.slider', - 'fobi.contrib.apps.drf_integration.form_elements.fields.slug', - 'fobi.contrib.apps.drf_integration.form_elements.fields.text', - 'fobi.contrib.apps.drf_integration.form_elements.fields.textarea', - 'fobi.contrib.apps.drf_integration.form_elements.fields.time', - 'fobi.contrib.apps.drf_integration.form_elements.fields.url', - - # DRF integration form element plugins - presentational - 'fobi.contrib.apps.drf_integration.form_elements.content.content_image', - 'fobi.contrib.apps.drf_integration.form_elements.content.content_image_url', - 'fobi.contrib.apps.drf_integration.form_elements.content.content_text', - 'fobi.contrib.apps.drf_integration.form_elements.content.content_video', - - # DRF integration form handler plugins - 'fobi.contrib.apps.drf_integration.form_handlers.db_store', - 'fobi.contrib.apps.drf_integration.form_handlers.mail', - 'fobi.contrib.apps.drf_integration.form_handlers.http_repost', - # ... - ] - -your_project/urls.py -#################### -Add the following code to the main ``urls.py`` of your project: - -.. code-block:: python - - # Conditionally including django-rest-framework integration app - if 'fobi.contrib.apps.drf_integration' in settings.INSTALLED_APPS: - from fobi.contrib.apps.drf_integration.urls import fobi_router - urlpatterns += [ - url(r'^api/', include(fobi_router.urls)) - ] - -Usage -~~~~~ -If you have followed the steps above precisely, you would be able to access -the API using ``http://localhost:8000/api/fobi-form-entry/``. - -Actions/methods supported: - -LIST -#### -.. code-block:: text - - GET /api/fobi-form-entry/ - -Lists all the forms available. Anonymous users would see the list of all -public forms. Authenticated users would see their own forms in addition -to the public forms. - -OPTIONS -####### -.. code-block:: text - - OPTIONS /api/fobi-form-entry/{FORM_SLUG}/ - -Lists all field options for the selected form. Private forms would be only -visible to authenticated users. - -PUT -### -.. code-block:: text - - PUT /api/fobi-form-entry/{FORM_SLUG}/ - - {DATA} - -Callbacks -~~~~~~~~~ -Callbacks work just the same way the core callbacks work. - -fobi_form_callbacks.py -###################### -.. code-block:: python - - from fobi.base import ( - integration_form_callback_registry, - IntegrationFormCallback, - ) - - from fobi.constants import ( - CALLBACK_BEFORE_FORM_VALIDATION, - CALLBACK_FORM_INVALID, - CALLBACK_FORM_VALID, - CALLBACK_FORM_VALID_AFTER_FORM_HANDLERS, - CALLBACK_FORM_VALID_BEFORE_SUBMIT_PLUGIN_FORM_DATA, - ) - - from fobi.contrib.apps.drf_integration import UID as INTEGRATE_WITH - - - class DRFSaveAsFooItem(IntegrationFormCallback): - """Save the form as a foo item, if certain conditions are met.""" - - stage = CALLBACK_FORM_VALID - integrate_with = INTEGRATE_WITH - - def callback(self, form_entry, request, **kwargs): - """Custom callback login comes here.""" - logger.debug("Great! Your form is valid!") - - - class DRFDummyInvalidCallback(IntegrationFormCallback): - """Saves the form as a foo item, if certain conditions are met.""" - - stage = CALLBACK_FORM_INVALID - integrate_with = INTEGRATE_WITH - - def callback(self, form_entry, request, **kwargs): - """Custom callback login comes here.""" - logger.debug("Damn! You've made a mistake, boy!") - -Testing -~~~~~~~ -To test Django REST framework integration package only, run the following -command: - -.. code-block:: sh - - ./runtests.py src/fobi/tests/test_drf_integration.py - -or use plain Django tests: - -.. code-block:: sh - - ./manage.py test fobi.tests.test_drf_integration --settings=settings.test - -Limitations -~~~~~~~~~~~ -Certain fields are not available yet (relational fields). - - -Form elements -------------- - - -Content form element -~~~~~~~~~~~~~~~~~~~~ -Presentational form elements for ``drf_integration``. - - -fobi.contrib.apps.drf_integration.form_elements.content.content_image -##################################################################### -A ``django-fobi`` ContentImage plugin for integration with -``Django REST framework``. Makes use of the -``fobi.contrib.apps.drf_integration.fields.ContentImage``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_image`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.content.content_image', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - -Usage -^^^^^ -Unlike standard fields, ``ContentImage`` field is purely presentational. -You're not supposed to make write actions on it (it won't work). Neither -will it be displayed in the browsable API (list/retrieve actions). However, -it will be listed in the options action call. - -**Sample JSON response fragment** - -.. code-block:: javascript - - "actions": { - "PUT": { - // ... - "content_image_89c8c319-195b-487a-a44d-f59ef14a5d44": { - "type": "content", - "required": false, - "read_only": true, - "contenttype": "image", - "content": "\n

\n\n\n\n\n\"Lorem\n\n\n

\n", - "raw": { - "file": "/media/fobi_plugins/content_image/test-image.jpg", - "alt": "Lorem ipsum", - "fit_method": "center", - "size": "500x500" - } - }, - // ... - } - } - -**JSON response fragment explained** - -- ``type`` (str): Set to "content" for all presentational form elements. -- ``contenttype`` (str): Set to "image" for ``ContentImage`` field. -- ``content`` (str): Representation of the content. Rendered partial HTML. -- ``raw`` (json dict): Raw attributes of the ``ContentImage`` plugin. Contains - "file", "alt", "fit_method" and "size" attributes. - - -fobi.contrib.apps.drf_integration.form_elements.content.content_image_url -######################################################################### -A ``django-fobi`` ContentImageURL plugin for integration with -``Django REST framework``. Makes use of the -``fobi.contrib.apps.drf_integration.fields.ContentImage``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_image_url`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.content.content_image_url', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - -Usage -^^^^^ -Unlike standard fields, ``ContentImageURL`` field is purely presentational. -You're not supposed to make write actions on it (it won't work). Neither -will it be displayed in the browsable API (list/retrieve actions). However, -it will be listed in the options action call. - -**Sample JSON response fragment** - -.. code-block:: javascript - - "actions": { - "PUT": { - // ... - "content_image_89c8c319-195b-487a-a44d-f59ef14a5d44": { - "type": "content", - "required": false, - "read_only": true, - "contenttype": "image", - "content": "\n

\n\n\n\n\n\"Lorem\n\n\n

\n", - "raw": { - "url": "http://example.com/media/test-image.jpg", - "alt": "Lorem ipsum", - "fit_method": "fit_width", - "size": "500x500" - } - }, - // ... - } - } - -**JSON response fragment explained** - -- ``type`` (str): Set to "content" for all presentational form elements. -- ``contenttype`` (str): Set to "image" for ``ContentImageURL`` field. -- ``content`` (str): Representation of the content. Rendered partial HTML. -- ``raw`` (json dict): Raw attributes of the ``ContentImageURL`` plugin. - Contains "url", "alt", "fit_method" and "size" attributes. - - -fobi.contrib.apps.drf_integration.form_elements.content.content_text -#################################################################### -A ``django-fobi`` ContentText plugin for integration with -``Django REST framework``. Makes use of the -``fobi.contrib.apps.drf_integration.fields.ContentText``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_text`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.content.content_text', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - -Usage -^^^^^ -Unlike standard fields, ``ContentText`` field is purely presentational. -You're not supposed to make write actions on it (it won't work). Neither -will it be displayed in the browsable API (list/retrieve actions). However, -it will be listed in the options action call. - -**Sample JSON response fragment** - -.. code-block:: javascript - - "actions": { - "PUT": { - // ... - "content_text_89c8c319-195b-487a-a44d-f59ef14a5d44": { - "type": "content", - "required": false, - "read_only": true, - "contenttype": "text", - "content": "\n

\n\nLorem ipsum dolor sit amet.\n\n\n

\n", - "raw": { - "text": "Lorem ipsum dolor sit amet." - } - }, - // ... - } - } - -**JSON response fragment explained** - -- ``type`` (str): Set to "content" for all presentational form elements. -- ``contenttype`` (str): Set to "text" for ``ContentText`` field. -- ``content`` (str): Representation of the content. Rendered partial HTML. -- ``raw`` (json dict): Raw attributes of the ``ContentText`` plugin. Contains - "text" attribute. - - -fobi.contrib.apps.drf_integration.form_elements.content.content_video -##################################################################### -A ``django-fobi`` ContentVideo plugin for integration with -``Django REST framework``. Makes use of the -``fobi.contrib.apps.drf_integration.fields.ContentVideo``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.content.content_video`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.content.content_video', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - -Usage -^^^^^ -Unlike standard fields, ``ContentVideo`` field is purely presentational. -You're not supposed to make write actions on it (it won't work). Neither -will it be displayed in the browsable API (list/retrieve actions). However, -it will be listed in the options action call. - -**Sample JSON response fragment** - -.. code-block:: javascript - - "actions": { - "PUT": { - // ... - "content_video_41a6b951-e6f9-4f08-ada6-3b109aa9a72f": { - "type": "content", - "required": false, - "read_only": true, - "contenttype": "video", - "content": "\n\n", - "raw": { - "title": "Cras risus ipsum faucibus", - "url": "https://www.youtube.com/watch?v=3P1qcVcs4Ik", - "size": "500x400" - } - }, - // ... - } - } - -**JSON response fragment explained** - -- ``type`` (str): Set to "content" for all presentational form elements. -- ``contenttype`` (str): Set to "video" for ``ContentVideo`` field. -- ``content`` (str): Representation of the content. Rendered partial HTML. -- ``raw`` (json dict): Raw attributes of the ``ContentVideo`` plugin. Contains - "title", "url" and "size" attributes. - - -Fields -~~~~~~ -Form fields for ``drf_integration``. - - -fobi.contrib.apps.drf_integration.form_elements.fields.boolean -############################################################## -A ``django-fobi`` BooleanField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.BooleanField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.boolean`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.boolean', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple -############################################################################### -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.MultipleChoiceField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.date -########################################################### -A ``django-fobi`` DateField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.DateField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.date`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.date', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down -##################################################################### -A ``django-fobi`` DateField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.DateField``. - -This plugin has been made primarily for compatibility with ``date_drop_down`` -plugin of the core package. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.datetime -############################################################### -A ``django-fobi`` DateField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.DateTimeField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.datetime`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.datetime', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.decimal -############################################################## -A ``django-fobi`` DecimalField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.DecimalField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.decimal`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.decimal', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.email -############################################################ -A ``django-fobi`` EmailField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.EmailField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.email`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.email', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.file -########################################################### -A ``django-fobi`` FileField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.FileField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.file`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.file', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.float -############################################################ -A ``django-fobi`` FloatField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.FloatField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.float`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.float', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.hidden -############################################################# -A ``django-fobi`` HiddenField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.HiddenField``. - -Note, that in terms of the Django REST framework it is a read-only field. -Any values posted along won't be saved. Initial value would. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.hidden`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.hidden', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.input -############################################################ -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.CharField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.input`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.input', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.integer -############################################################## -A ``django-fobi`` IntegerField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.IntegerField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.integer`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.integer', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.ip_address -################################################################# -A ``django-fobi`` IPAddressField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.IPAddressField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.ip_address`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.ip_address', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean -################################################################### -A ``django-fobi`` NullBooleanField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.NullBooleanField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.password -############################################################### -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.CharField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.password`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.password', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.radio -############################################################ -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.ChoiceField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.radio`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.radio', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.range_select -################################################################### -A ``django-fobi`` ChoiceField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.ChoiceField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.range_select`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.range_select', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.regex -############################################################ -A ``django-fobi`` RegexField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.RegexField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.regex`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.regex', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.select -############################################################# -A ``django-fobi`` ChoiceField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.ChoiceField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.select`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.select', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple -###################################################################### -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.MultipleChoiceField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple -###################################################################### -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.MultipleChoiceField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.slider -############################################################# -A ``django-fobi`` ChoiceField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.ChoiceField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.slider`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.slider', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.slug -########################################################### -A ``django-fobi`` SlugField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.SlugField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.slug`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.slug', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.text -########################################################### -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.CharField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.text`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.text', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.textarea -############################################################### -A ``django-fobi`` CharField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.CharField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.textarea`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.textarea', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.time -########################################################### -A ``django-fobi`` TimeField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.TimeField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.time`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.time', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_elements.fields.url -########################################################## -A ``django-fobi`` URLField plugin for integration with -``Django REST framework``. Makes use of the -``rest_framework.fields.URLField``. - -Installation -^^^^^^^^^^^^ -1. Add ``fobi.contrib.apps.drf_integration.form_elements.fields.time`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_elements.fields.url', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -Form handlers -------------- -Form handlers for ``drf_integration``. - - -fobi.contrib.apps.drf_integration.form_handlers.db_store -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A ``django-fobi`` Mail form handler plugin for integration -with ``Django REST framework``. Saves submitted form data into the -``SavedFormDataEntry`` model. - -Installation -############ -1. Add ``fobi.contrib.apps.drf_integration.form_handlers.db_store`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_handlers.db_store', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./manage.py migrate - - ./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. - - -fobi.contrib.apps.drf_integration.form_handlers.http_repost -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A ``django-fobi`` HTTP repost form handler plugin for integration -with ``Django REST framework``. Submits the form to another endpoint specified. - -Installation -############ -1. Add ``fobi.contrib.apps.drf_integration.form_handlers.http_respost`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_handlers.http_repost', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./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. - - -fobi.contrib.apps.drf_integration.form_handlers.mail -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A ``django-fobi`` Mail form handler plugin for integration -with ``Django REST framework``. Submits the form data by email to the -specified email address. - -Installation -############ -1. Add ``fobi.contrib.apps.drf_integration.form_handlers.mail`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - -.. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.apps.drf_integration.form_handlers.mail', - # ... - ) - -2. In the terminal type: - -.. code-block:: sh - - ./manage.py migrate - - ./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. - - -fobi.contrib.apps.feincms_integration -------------------------------------- -A ``django-fobi`` integration with FeinCMS. - -Installation -~~~~~~~~~~~~ -Versions -######## -See the `requirements file -`_. - -your_project/settings.py -######################## -See the `example settings file -`_. - -.. code-block:: python - - INSTALLED_APPS = list(INSTALLED_APPS) - INSTALLED_APPS += [ - 'feincms', # FeinCMS - - 'fobi.contrib.apps.feincms_integration', # Fobi FeinCMS app - - 'page', # Example - ] - - FEINCMS_RICHTEXT_INIT_CONTEXT = { - 'TINYMCE_JS_URL': STATIC_URL + 'tiny_mce/tiny_mce.js', - } - -your_project/page/models.py -########################### -.. code-block:: python - - from django.utils.translation import ugettext_lazy as _ - - from feincms.module.page.models import Page - from feincms.content.raw.models import RawContent - from feincms.content.richtext.models import RichTextContent - # Import the ``django-fobi`` widget. - from fobi.contrib.apps.feincms_integration.widgets import FobiFormWidget - - Page.register_extensions('feincms.module.extensions.translations',) - - # Register basic template. - Page.register_templates( - { - 'title': _(u"Base template"), - 'path': 'page/base.html', - 'key': 'page_base', - 'regions': ( - ('main', _(u"Main")), - ('sidebar', _(u"Sidebar")), - ) - }, - ) - - # Standard content types - Page.create_content_type(RawContent) - Page.create_content_type(RichTextContent) - - # Register the ``django-fobi`` widget. - Page.create_content_type(FobiFormWidget) - -your_project/admin.py -##################### -.. code-block:: python - - from django.contrib import admin - - from feincms.module.page.modeladmins import PageAdmin - - from page.models import Page - - admin.site.register(Page, PageAdmin) - -Information for developers -########################## -Template rendering -^^^^^^^^^^^^^^^^^^ -The embed FeinCMS widget is rendered with use of two theme templates: - -- ``view_embed_form_entry_ajax_template``: Used for rendering the form. -- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form - sent event. - -Using custom templates for rendering the widget -############################################### -In the widget, you can specify a template which you want to be used for -rendering the form or the form-sent event. - -Example: - -.. code-block:: python - - FOBI_FEINCMS_INTEGRATION_FORM_TEMPLATE_CHOICES = ( - ("yourapp/custom_view_embed_form_v1.html", - "Custom embed form view template #1"), - ("yourapp/custom_view_embed_form_v2.html", - "Custom embed form view template #2"), - ) - -Same goes for form-sent templates. - -.. code-block:: python - - FOBI_FEINCMS_INTEGRATION_SUCCESS_PAGE_TEMPLATE_CHOICES = ( - ("yourapp/custom_embed_form_submitted_v1.html", - "Custom form-sent template #1"), - ("yourapp/custom_embed_form_submitted_v2.html", - "Custom form-sent template #2"), - ) - -Registering a template in the ``FORM_TEMPLATE_CHOICES`` makes it available -for all the themes. If you rather want to use different custom templates -for different themes, use the ``FOBI_CUSTOM_THEME_DATA`` as shown in the -example below. - -.. code-block:: python - - FOBI_CUSTOM_THEME_DATA = { - 'bootstrap3': { - 'feincms_integration': { - 'form_template_choices': [ - ('fobi/bootstrap3_extras/view_embed_form.html', - "Custom bootstrap3 embed form view template"), - ], - 'success_page_template_choices': [ - ('fobi/bootstrap3_extras/embed_form_submitted.html', - "Custom bootstrap3 embed form entry submitted template"), - ], - }, - }, - 'foundation5': { - 'feincms_integration': { - 'form_template_choices': [ - ('fobi/foundation5_extras/view_embed_form.html', - "Custom foundation5 embed form view template"), - ], - 'success_page_template_choices': [ - ('fobi/foundation5_extras/embed_form_submitted.html', - "Custom foundation5 embed form entry submitted template"), - ], - }, - }, - } - -Usage -~~~~~ -The ``fobi.contrib.apps.feincms_integration.widgets.FobiFormWidget`` consists -of the following fields: - -- Form: The form to be used. -- Form template name: Template to be used to render the embed form. -- Hide form title: If checked, no form title would be shown. -- Form title: Overrides the standard form title. -- Submit button text: Overrides the default submit button text. -- Success page template name: Template to be used to render the embed form-sent - event. -- Hide success page title: If checked, no form-sent title would be shown. -- Success page title: Overrides the form-sent title. -- Success page text: Overrides the form-sent text. - - -fobi.contrib.apps.mezzanine_integration ---------------------------------------- -A ``django-fobi`` integration with Mezzanine. - -Installation -~~~~~~~~~~~~ -Versions -######## -See the `requirements file -`_. - -your_project/settings.py -######################## -See the `example settings file -`_. - -.. code-block:: python - - INSTALLED_APPS = list(INSTALLED_APPS) - INSTALLED_APPS += [ - # Standard mezzanine apps - - 'fobi.contrib.apps.mezzanine_integration', # Fobi Mezzanine app - ] - -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. -- ``embed_form_entry_submitted_ajax_template``: Used for rendering the form - 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. - -Example: - -.. code-block:: python - - FOBI_MEZZANINE_INTEGRATION_FORM_TEMPLATE_CHOICES = ( - ("yourapp/custom_view_embed_form_v1.html", - "Custom embed form view template #1"), - ("yourapp/custom_view_embed_form_v2.html", - "Custom embed form view template #2"), - ) - -Same goes for form-sent templates. - -.. code-block:: python - - FOBI_MEZZANINE_INTEGRATION_SUCCESS_PAGE_TEMPLATE_CHOICES = ( - ("yourapp/custom_embed_form_submitted_v1.html", - "Custom form-sent template #1"), - ("yourapp/custom_embed_form_submitted_v2.html", - "Custom form-sent template #2"), - ) - -Registering a template in the ``FORM_TEMPLATE_CHOICES`` makes it available -for all the themes. If you rather want to use different custom templates -for different themes, use the ``FOBI_CUSTOM_THEME_DATA`` as shown in the -example below. - -.. code-block:: python - - FOBI_CUSTOM_THEME_DATA = { - 'bootstrap3': { - 'mezzanine_integration': { - 'form_template_choices': [ - ('fobi/bootstrap3_extras/view_embed_form.html', - "Custom bootstrap3 embed form view template"), - ], - 'success_page_template_choices': [ - ('fobi/bootstrap3_extras/embed_form_submitted.html', - "Custom bootstrap3 embed form entry submitted template"), - ], - }, - }, - 'foundation5': { - 'mezzanine_integration': { - 'form_template_choices': [ - ('fobi/foundation5_extras/view_embed_form.html', - "Custom foundation5 embed form view template"), - ], - 'success_page_template_choices': [ - ('fobi/foundation5_extras/embed_form_submitted.html', - "Custom foundation5 embed form entry submitted template"), - ], - }, - }, - } - -Usage -~~~~~ -The ``fobi`` page model -####################### -The ``fobi.contrib.apps.mezzanine_integration.models.FobiFormPage`` consists -of the following fields: - -- Form: The form to be used. -- Form template name: Template to be used to render the embed form. -- Hide form title: If checked, no form title would be shown. -- Form title: Overrides the standard form title. -- Submit button text: Overrides the default submit button text. -- Success page template name: Template to be used to render the embed form-sent - event. -- Hide success page title: If checked, no form-sent title would be shown. -- Success page title: Overrides the form-sent title. -- Success page text: Overrides the form-sent text. - -Steps described -############### -1. If you use the 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. - - -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``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'easy_thumbnails', - 'fobi.contrib.plugins.form_elements.content.content_image', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(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. - - -fobi.contrib.plugins.form_elements.content.content_image_url ------------------------------------------------------------- -A ``Fobi`` ImageURL form element plugin. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.content.content_image_url`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.content.content_image_url', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Additionally, for the fine tuning, see the - ``fobi.contrib.plugins.form_elements.content.content_image_url.defaults`` - module. If necessary, override the settings by prepending - ``FOBI_PLUGIN_CONTENT_IMAGE_URL_`` to the desired variable name from the - above mentioned ``defaults`` module. - - -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``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.content.content_text', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(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 `_ 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 - - - ALLOWED_TAGS: - - ALLOWED_ATTRIBUTES: - - The default values are: - - .. code-block:: python - - ALLOWED_TAGS = [ - 'a', - 'abbr', - 'acronym', - 'b', - 'blockquote', - 'code', - 'em', - 'i', - 'li', - 'ol', - 'strong', - 'ul', - ] - - ALLOWED_ATTRIBUTES = { - 'a': ['href', 'title'], - 'abbr': ['title'], - 'acronym': ['title'], - } - - -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``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.content.content_video', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(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. - - -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``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.boolean', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -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``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(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): - - .. code-block:: python - - [ - ('alpha', 'Alpha'), - ('beta', 'Beta'), - ('gamma', 'Gamma'), - ] - - - "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. - -Usage -~~~~~ -You should be entering a single choice per line. Choice might -consist of just a single value or value/label pair. - -For example: - -.. code-block:: text - - 1 - 2 - alpha, Alpha - beta, Beta - omega - -The following HTML would be made of: - -.. code-block:: html - -
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
- - -fobi.contrib.plugins.form_elements.fields.date ----------------------------------------------- -A ``Fobi`` Date form field plugin. Makes use of the -``django.forms.fields.DateField`` and ``django.forms.widgets.DateInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.date`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.date', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.date_drop_down --------------------------------------------------------- -A ``Fobi`` Birthday form field plugin. Makes use of the -``django.forms.fields.DateField`` and -``django.forms.extras.widgets.SelectDateWidget``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.date_drop_down`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.date_drop_down', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.datetime --------------------------------------------------- -A ``Fobi`` DateTime form field plugin. Makes use of the -``django.forms.fields.DateTimeField`` and -``django.forms.widgets.DateTimeInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.datetime`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.datetime', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.decimal -------------------------------------------------- -A ``Fobi`` Decimal form field plugin. Makes use of the -``django.forms.fields.DecimalField`` and ``django.forms.widgets.NumberInput`` -(falling back to ``django.forms.widgets.TextInput`` for older Django -versions). - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.decimal`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.decimal', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.email ------------------------------------------------ -A ``Fobi`` Email form field plugin. Makes use of the -``django.forms.fields.EmailField`` and ``django.forms.widgets.TextInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.email`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.email', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.file ----------------------------------------------- -A ``Fobi`` File form field plugin. Makes use of the -``django.forms.fields.FileField`` and -``django.forms.widgets.ClearableFileInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.file`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.file', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) By default uploaded files are stored in the "fobi_plugins/file" directory - of the media root. If you want to change the directory location, - set the ``FOBI_PLUGIN_FIELDS_FILE_FILES_UPLOAD_DIR`` value to the desired - (relative) path. - - -fobi.contrib.plugins.form_elements.fields.float ------------------------------------------------ -A ``Fobi`` Integer form field plugin. Makes use of the -``django.forms.fields.FloatField`` and ``django.forms.widgets.NumberInput`` -(falling back to ``django.forms.widgets.TextInput`` for older Django -versions). - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.float`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.float', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.hidden ------------------------------------------------- -A ``Fobi`` Hidden form field plugin. Makes use of the -``django.forms.fields.CharField`` and ``django.forms.widgets.HiddenInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.hidden`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.hidden', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.input ------------------------------------------------ -A generic input form field plugin. Makes use of the -``django.forms.fields.Field`` and ``django.forms.widgets.Input``. -Comes with a lot of options you likely won't use every day. - -The full list of supported HTML properties is listed below: - -- autocomplete -- autofocus -- disabled -- list -- max -- min -- multiple -- pattern -- placeholder -- readonly -- step -- type - -See `w3schools.com `_ for further -explanations. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.input`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.input', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.integer -------------------------------------------------- -A ``Fobi`` Integer form field plugin. Makes use of the -``django.forms.fields.IntegerField`` and ``django.forms.widgets.NumberInput`` -(falling back to ``django.forms.widgets.TextInput`` for older Django -versions). - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.integer`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.integer', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.ip_address ----------------------------------------------------- -A ``Fobi`` Text form field plugin. Makes use of the -``django.forms.fields.GenericIPAddressField`` and -``django.forms.widgets.TextInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.ip_address`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.ip_address', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.null_boolean ------------------------------------------------------- -A ``Fobi`` NullBoolean form field plugin. Makes use of the -``django.forms.fields.NullBooleanField`` and -``django.forms.widgets.NullBooleanSelect``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.null_boolean`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.null_boolean', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.password --------------------------------------------------- -A ``Fobi`` Password form field plugin. Makes use of the -``django.forms.fields.CharField`` and ``django.forms.widgets.PasswordInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.password`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.password', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.radio ------------------------------------------------ -A ``Fobi`` Radio form field plugin. Makes use of the -``django.forms.fields.ChoiceField`` and ``django.forms.widgets.RadioSelect``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.radio`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.radio', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) By default, the submitted form value of `radio` - 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): - - .. code-block:: python - - [ - ('alpha', 'Alpha'), - ('beta', 'Beta'), - ('gamma', 'Gamma'), - ] - - .. code-block:: text - - - "val": `value` (example: "alpha"). - - "repr" (default): `label` (example: "Alpha"). - - "mix": `value (label)` (example: "Alpha (alpha)"). - - Simply set the - ``FOBI_FORM_ELEMENT_RADIO_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. - -For example: - -.. code-block:: text - - 1 - 2 - alpha, Alpha - beta, Beta - omega - -The following HTML would be made of: - -.. code-block:: html - - - - -fobi.contrib.plugins.form_elements.fields.range_select ------------------------------------------------------- -A ``Fobi`` RangeSelect form field plugin. Makes use of the -``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.range_select`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.range_select', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Ranges are specified within the given min/max values. The default values - are: - - .. code-block:: text - - - INITIAL: 50 - - INITIAL_MAX_VALUE: 100 - - INITIAL_MIN_VALUE: 0 - - MIN_VALUE: 0 - - MAX_VALUE: 100 - - STEP: 1 - - However, you can override each of them in the settings of your project by - prefixing correspondent names with `FOBI_FORM_ELEMENT_RANGE_SELECT_`: - - .. code-block:: text - - - FOBI_FORM_ELEMENT_RANGE_SELECT_INITIAL - - FOBI_FORM_ELEMENT_RANGE_SELECT_INITIAL_MAX_VALUE - - FOBI_FORM_ELEMENT_RANGE_SELECT_INITIAL_MIN_VALUE - - FOBI_FORM_ELEMENT_RANGE_SELECT_MIN_VALUE - - FOBI_FORM_ELEMENT_RANGE_SELECT_MAX_VALUE - - FOBI_FORM_ELEMENT_RANGE_SELECT_STEP - - -fobi.contrib.plugins.form_elements.fields.regex ------------------------------------------------ -A ``Fobi`` Text form field plugin. Makes use of the -``django.forms.fields.RegexField`` and ``django.forms.widgets.TextInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.regex`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.regex', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.select ------------------------------------------------- -A ``Fobi`` Select form field plugin. Makes use of the -``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.select`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.select', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) By default, the submitted form value of `select` - 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): - - .. code-block:: python - - [ - ('alpha', 'Alpha'), - ('beta', 'Beta'), - ('gamma', 'Gamma'), - ] - - .. code-block:: text - - - "val": `value` (example: "alpha"). - - "repr" (default): `label` (example: "Alpha"). - - "mix": `value (label)` (example: "Alpha (alpha)"). - - Simply set the - ``FOBI_FORM_ELEMENT_SELECT_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. - -For example: - -.. code-block:: text - - 1 - 2 - alpha, Alpha - beta, Beta - omega - -The following HTML would be made of: - -.. code-block:: html - - - - -fobi.contrib.plugins.form_elements.fields.select_model_object -------------------------------------------------------------- -A ``Fobi`` Select Model Object form field plugin. Makes use of the -``django.forms.models.ModelChoiceField`` and ``django.forms.widgets.Select``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.select_model_object`` to - the ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.select_model_object', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Make sure to take a look at - ``fobi.contrib.plugins.form_elements.fields.select_model_object.defaults.IGNORED_MODELS``. - If necessary, override it in your `settings` as shown in the example below: - - .. code-block:: python - - FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_IGNORED_MODELS = [ - 'auth.User', - 'auth.Group', - ] - -(5) By default, the submitted form value of `select_model_object` elements is - `app_label.model_name.object_pk.object_repr`. However, that part of the - behaviour has been made configurable. You can choose between the following - options: - - .. code-block:: text - - - "val": `app_label.model_name.object_pk.object_repr`. - - "repr": `object_repr` (uses the ``__unicode__`` method of the model). - - "mix" (default): `app_label.model_name.object_pk.object_repr`. - - Simply set the ``FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_SUBMIT_VALUE_AS`` - assign one of the following values: "val", "repr" or "mix" to get the - desired behaviour. - - -fobi.contrib.plugins.form_elements.fields.select_mptt_model_object ------------------------------------------------------------------- -A ``Fobi`` Select MPTT Model Object form field plugin. Makes use of the -``mptt.fields.TreeNodeChoiceField`` and ``django.forms.widgets.Select``. - -Installation -~~~~~~~~~~~~ -Install `django-mptt` -##################### -Taken from django-mptt `Getting started -`_. - -1. Download ``django-mptt`` using pip by running: - -.. code-block:: sh - - pip install django-mptt - -2. Add ``mptt`` to the ``INSTALLED_APPS`` in your ``settings.py``. - -Install `select_mptt_model_object` plugin -######################################### -(1) Add ``mptt`` and - ``fobi.contrib.plugins.form_elements.fields.select_mptt_model_object`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'mptt', - 'fobi.contrib.plugins.form_elements.fields.select_mptt_model_object', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Make sure to take a look at - ``fobi.contrib.plugins.form_elements.fields.select_mptt_model_object.defaults.IGNORED_MODELS``. - If necessary, override it in your `settings` as shown in the example below: - - .. code-block:: python - - FOBI_FORM_ELEMENT_SELECT_MPTT_MODEL_OBJECT_IGNORED_MODELS = [ - 'auth.User', - 'auth.Group', - ] - -(5) By default, the submitted form value of `select_mptt_model_object` elements - is `app_label.model_name.object_pk.object_repr`. However, that part of the - behaviour has been made configurable. You can choose between the following - options: - - .. code-block:: text - - - "val": `app_label.model_name.object_pk.object_repr`. - - "repr": `object_repr` (uses the ``__unicode__`` method of the model). - - "mix" (default): `app_label.model_name.object_pk.object_repr`. - - Simply set the ``FOBI_FORM_ELEMENT_SELECT_MPTT_MODEL_OBJECT_SUBMIT_VALUE_AS`` - assign one of the following values: "val", "repr" or "mix" to get the - desired behaviour. - - -fobi.contrib.plugins.form_elements.fields.select_multiple ---------------------------------------------------------- -A ``Fobi`` Select Multiple form field plugin. Makes use of the -``django.forms.fields.MultipleChoiceField`` and -``django.forms.widgets.SelectMultiple``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.select_multiple`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.select_multiple', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(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): - - .. code-block:: python - - [ - ('alpha', 'Alpha'), - ('beta', 'Beta'), - ('gamma', 'Gamma'), - ] - - .. code-block:: text - - - "val": `value` (example: "alpha"). - - "repr" (default): `label` (example: "Alpha"). - - "mix": `value (label)` (example: "Alpha (alpha)"). - - Simply set the - ``FOBI_FORM_ELEMENT_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. - -For example: - -.. code-block:: text - - 1 - 2 - alpha, Alpha - beta, Beta - omega - -The following HTML would be made of: - -.. code-block:: html - - - - -fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects ------------------------------------------------------------------------ -A ``Fobi`` Select Multiple Model Objects form field plugin. Makes use of the -``django.forms.models.ModelMultipleChoiceField`` and -``django.forms.widgets.SelectMultiple``. - -Installation -~~~~~~~~~~~~ -(1) Add - ``fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Make sure to take a look at - ``fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects.defaults.IGNORED_MODELS``. - If necessary, override it in your `settings` as shown in the example below: - - .. code-block:: python - - FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MODEL_OBJECTS_IGNORED_MODELS = [ - 'auth.User', - 'auth.Group', - ] - -(5) By default, the submitted form value of `select_multiple_model_objects` - elements is `app_label.model_name.object_pk.object_repr`. However, that - part of the behaviour has been made configurable. You can choose between - the following options: - - .. code-block:: text - - - "val": `app_label.model_name.object_pk.object_repr`. - - "repr": `object_repr` (uses the ``__unicode__`` method of the model). - - "mix" (default): `app_label.model_name.object_pk.object_repr`. - - Simply set the - ``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MODEL_OBJECTS_SUBMIT_VALUE_AS`` assign - one of the following values: "val", "repr" or "mix" to get the desired - behaviour. - - -fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects ----------------------------------------------------------------------------- -A ``Fobi`` Select Multiple MPTT Model Objects form field plugin. Makes use of -the ``mptt.forms.TreeNodeMultipleChoiceField`` and -``django.forms.widgets.SelectMultiple``. - -Installation -~~~~~~~~~~~~ -Install `django-mptt` -##################### -Taken from django-mptt `Getting started -`_. - -1. Download ``django-mptt`` using pip by running: - -.. code-block:: sh - - pip install django-mptt - -2. Add ``mptt`` to the ``INSTALLED_APPS`` in your ``settings.py``. - -Install `select_multiple_mptt_model_objects` plugin -################################################### -(1) Add - ``fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'mptt', - 'fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Make sure to take a look at - ``fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects.defaults.IGNORED_MODELS``. - If necessary, override it in your `settings` as shown in the example below: - - .. code-block:: python - - FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MPTT_MODEL_OBJECTS_IGNORED_MODELS = [ - 'auth.User', - 'auth.Group', - ] - -(5) By default, the submitted form value of `select_multiple_mptt_model_objects` - elements is `app_label.model_name.object_pk.object_repr`. However, that part - of the behaviour has been made configurable. You can choose between the - following options: - - .. code-block:: text - - - "val": `app_label.model_name.object_pk.object_repr`. - - "repr": `object_repr` (uses the ``__unicode__`` method of the model). - - "mix" (default): `app_label.model_name.object_pk.object_repr`. - - Simply set the - ``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MPTT_MODEL_OBJECTS_SUBMIT_VALUE_AS`` - assign one of the following values: "val", "repr" or "mix" to get the - desired behaviour. - - -fobi.contrib.plugins.form_elements.fields.select_multiple_with_max ------------------------------------------------------------------- -A ``Fobi`` Select Multiple form field plugin with max choices. Makes use of -the ``django.forms.widgets.SelectMultiple``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.select_multiple_with_max`` - to the ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.select_multiple_with_max', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) By default, the submitted form value of `select_multiple_with_max` - 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): - - .. code-block:: python - - [ - ('alpha', 'Alpha'), - ('beta', 'Beta'), - ('gamma', 'Gamma'), - ] - - .. code-block:: text - - - "val": `value` (example: "alpha"). - - "repr" (default): `label` (example: "Alpha"). - - "mix": `value (label)` (example: "Alpha (alpha)"). - - Simply set the - ``FOBI_FORM_ELEMENT_SELECT_MULTIPLE_WITH_MAX_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. If you enter an integer in -the 'max_choices' field, the user can choose only or less choices. - -For example: - -.. code-block:: text - - 1 - 2 - alpha, Alpha - beta, Beta - omega - -The following HTML would be made of: - -.. code-block:: html - - - - -fobi.contrib.plugins.form_elements.fields.slider ------------------------------------------------- -A ``Fobi`` Percentage form field plugin. Makes use of the -``django.forms.fields.ChoiceField`` and ``django.forms.widgets.Select``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.slider`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.slider', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Ranges are specified within the given min/max values. The default values - are: - - .. code-block:: text - - - INITIAL: 50 - - INITIAL_MAX_VALUE: 100 - - INITIAL_MIN_VALUE: 0 - - MIN_VALUE: 0 - - MAX_VALUE: 100 - - STEP: 1 - - However, you can override each of them in the settings of your project by - prefixing correspondent names with `FOBI_FORM_ELEMENT_SLIDER_`: - - .. code-block:: text - - - FOBI_FORM_ELEMENT_SLIDER_INITIAL - - FOBI_FORM_ELEMENT_SLIDER_INITIAL_MAX_VALUE - - FOBI_FORM_ELEMENT_SLIDER_INITIAL_MIN_VALUE - - FOBI_FORM_ELEMENT_SLIDER_MIN_VALUE - - FOBI_FORM_ELEMENT_SLIDER_MAX_VALUE - - FOBI_FORM_ELEMENT_SLIDER_STEP - - -fobi.contrib.plugins.form_elements.fields.text ----------------------------------------------- -A ``Fobi`` Text form field plugin. Makes use of the -``django.forms.fields.CharField`` and ``django.forms.widgets.TextInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.text`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.text', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.textarea --------------------------------------------------- -A ``Fobi`` Textarea form field plugin. Makes use of the -``django.forms.fields.CharField`` and ``django.forms.widgets.Textarea``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.textarea`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.textarea', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.time ----------------------------------------------- -A ``Fobi`` DateTime form field plugin. Makes use of the -``django.forms.fields.TimeField`` and -``django.forms.widgets.TextInput``. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.time`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.time', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.fields.url ---------------------------------------------- -A ``Fobi`` URL form field plugin. Makes use of the -``django.forms.fields.URLField`` and ``django.forms.widgets.URLInput`` falling -back to ``django.forms.widgets.TextInput`` for older Django versions. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.fields.url`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.fields.url', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.security.captcha ---------------------------------------------------- -A `CAPTCHA `_ form field plugin. Makes -use of the `django-simple-captcha -`_. - -Prerequisites -~~~~~~~~~~~~~ -You will need ``libfreetype6``, otherwise ``django-captcha`` won't work. - -.. code-block:: sh - - sudo apt-get install libfreetype6-dev - -Installation -~~~~~~~~~~~~ -Install `django-simple-captcha` -############################### -Taken from django-simple-captcha `installation instructions -`_. - -(1) Download ``django-simple-captcha`` using pip by running: - - .. code-block:: sh - - pip install django-simple-captcha - -(2) Add ``captcha`` to the ``INSTALLED_APPS`` in your ``settings.py``. - -(3) Run ``python manage.py syncdb`` (or ``python manage.py migrate`` if you are - managing database migrations via South) to create the required database - tables. - -(4) Add an entry to your ``urls.py``: - - .. code-block:: python - - urlpatterns += [ - url(r'^captcha/', include('captcha.urls')), - ] - -Install `fobi` Captcha plugin -############################# -(1) Add ``fobi.contrib.plugins.form_elements.security.captcha`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.security.captcha', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -Troubleshooting and usage limitations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In combination with other captcha solutions -########################################### -At the moment, you can't use both ``CAPTCHA`` -(fobi.contrib.plugins.form_elements.security.captcha) and ``ReCAPTCHA`` -(fobi.contrib.plugins.form_elements.security.recaptcha) plugins alongside due -to app name collision of the ``django-simple-captcha`` and ``django-recaptcha`` -packages. That limitation is likely to be solved in future in the -``django-recaptcha`` package. Until then, you should choose either one or -another, but not both on the same time. - -Usage -~~~~~ -Note, that unlike most of the other form element plugins, default -value for the ``required`` attribute is True, which makes the Captcha -obligatory. Although you could still set it to False, it does not make -much sense to do so. - - -fobi.contrib.plugins.form_elements.security.honeypot ----------------------------------------------------- -A `Honeypot `_ -form field plugin. Just another anti-spam technique. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.security.honeypot`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.security.honeypot', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_elements.security.recaptcha ------------------------------------------------------ -A `ReCAPTCHA `_ form field plugin. -Makes use of the `django-recaptcha -`_. - -Installation -~~~~~~~~~~~~ -Install `django-recaptcha` -########################## -(1) Download ``django-recaptcha`` using pip by running: - - .. code-block:: sh - - pip install django-recaptcha - -(2) Add ``captcha`` to the ``INSTALLED_APPS`` in your ``settings.py``. - -(3) Run ``python manage.py syncdb`` (or ``python manage.py migrate`` if you are - managing database migrations via South) to create the required database - tables. - -Install `fobi` ReCAPTCHA plugin -############################### -(1) Add ``fobi.contrib.plugins.form_elements.security.recaptcha`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.security.recaptcha', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - -(4) Specify the following ReCAPTCHA credentials in your settings. - - .. code-block:: text - - - ``RECAPTCHA_PUBLIC_KEY`` - - ``RECAPTCHA_PRIVATE_KEY`` - -Troubleshooting and usage limitations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In combination with other captcha solutions -########################################### -At the moment, you can't use both ``CAPTCHA`` -(fobi.contrib.plugins.form_elements.security.captcha) and ``ReCAPTCHA`` -(fobi.contrib.plugins.form_elements.security.recaptcha) plugins alongside due -to app name collision of the ``django-simple-captcha`` and ``django-recaptcha`` -packages. That limitation is likely to be solved in future in the -``django-recaptcha`` package. Until then, you should choose either one or -another, but not both on the same time. - -If you happen to see errors like "Input error: k: Format of site key was -invalid", make sure to have defined (and filled in properly) the -``RECAPTCHA_PUBLIC_KEY`` and ``RECAPTCHA_PRIVATE_KEY`` in your settnings.py. -See the `following `_ -thread for more information. - -Usage -~~~~~ -Note, that unlike most of the other form element plugins, default -value for the ``required`` attribute is True, which makes the ReCaptcha -obligatory. Although you could still set it to False, it does not make -much sense to do so. - - -fobi.contrib.plugins.form_elements.test.dummy ---------------------------------------------- -A ``Fobi`` Dummy form element plugin. Created for testing purposes. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_elements.test.dummy`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_elements.test.dummy', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_handlers.db_store -------------------------------------------- -A ``Fobi`` Database Store form-/wizard- handler plugin. Saves submitted form -data into the ``SavedFormDataEntry``/``SavedFormWizardDataEntry`` models. - -Dependencies -~~~~~~~~~~~~ -The `xlwt `_ package is required -(optional) for XLS export. If not present, export format falls back -to CSV. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_handlers.db_store`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_handlers.db_store', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./manage.py migrate - - ./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. - -(4) Add db_store form handler plugin URLs to the urls.py of your project. - - .. code-block:: python - - urlpatterns = [ - # DB Store plugin URLs - url(r'^fobi/plugins/form-handlers/db-store/', - include('fobi.contrib.plugins.form_handlers.db_store.urls')), - ] - - For form wizards do: - - .. code-block:: python - - urlpatterns = [ - # DB Store plugin URLs - url(r'^fobi/plugins/form-wizard-handlers/db-store/', - include('fobi.contrib.plugins.form_handlers.db_store.urls.' - 'form_wizard_handlers')), - ] - - -fobi.contrib.plugins.form_handlers.http_repost ----------------------------------------------- -A ``Fobi`` HTTP Repost form handler plugin. Submits the form -data as is to the given endpoint. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_handlers.http_repost`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_handlers.http_repost', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -fobi.contrib.plugins.form_handlers.mail ---------------------------------------- -A ``Fobi`` Mail form handler plugin. Submits the form -data by email to the specified email address. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.plugins.form_handlers.mail`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.plugins.form_handlers.mail', - # ... - ) - -(2) In the terminal type: - - .. code-block:: sh - - ./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. - - -mailchimp_importer ------------------- -A ``django-fobi`` integration with MailChimp. - -This plugin makes it possible to import a form from a MailChimp list. A typical -list URL would be `this `_. In the -listing you would see list names and `Stats` at the right corner. If you click -on it you would see the `Settings` link. Follow it and scroll to the bottom for -the unique id for your list. Now, if you have been successfully authenticated -to the MailChimp API using your API_KEY, you could call the `lists.merge_vars` -method for getting the form. API_KEY could be obtained from the MailChimp -in the `Account API `_. - -For additional information on MailChimp import see the following `article -`_. - -Prerequisites -~~~~~~~~~~~~~ -Python wrapper for the Mailchimp: - -.. code-block:: sh - - pip install mailchimp - -If you are using Django 1.8 or greater, you would need `django-formtools` -package as well: - -.. code-block:: sh - - pip install django-formtools - -Installation -~~~~~~~~~~~~ -your_project/settings.py -######################## -.. code-block:: python - - INSTALLED_APPS = list(INSTALLED_APPS) - INSTALLED_APPS += [ - 'fobi.contrib.plugins.form_importers.mailchimp_importer', - ] - -How it works -~~~~~~~~~~~~ -Assuming that you have configured the `mailchimp_importer` plugin properly and -have the Django running locally on port 8000, accessing the following URL would -bring you to the MailChimp form import wizard. - -- http://localhost:8000/en/fobi/forms/importer/mailchimp/ - -On the first step you would be asked to provide your API_KEY, which is used -to authenticate to the MailChimp in order to fetch your list- and form- -information. The key isn't stored/saved/remembered. Next time you want to -import a form from the same account, you would have to provide it again. - -Development status -~~~~~~~~~~~~~~~~~~ -This part of code is alpha, which means it experimental and needs improvements. - -See the `TODOS `_ -for the full list of planned-, pending- in-development- or to-be-implemented -features. - -If you want to improve it or did make it working, please, make a pull request. - - -fobi.contrib.themes.bootstrap3 ------------------------------- -A ``django-fobi`` Bootstrap 3 theme. Based on the ??? template. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.themes.bootstrap3`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.themes.bootstrap3', - # ... - ) - -(2) Specify ``bootstrap3`` as a default theme in your ``settings.py``: - - .. code-block:: python - - FOBI_DEFAULT_THEME = 'bootstrap3' - - -fobi.contrib.themes.djangocms_admin_style_theme ------------------------------------------------ -A ``django-fobi`` theme in a style of ``djangocms-admin-style`` admin. -Relies on ``djangocms-admin-style`` package and some jQuery UI only. - -jQuery UI "Smoothness" theme comes from `here `_. - -Installation -~~~~~~~~~~~~ -Install `djangocms-admin-style` -############################### -See the original `installation instructions -`_. - -(1) Install the ``djangocms-admin-style`` package. - - .. code-block:: sh - - pip install djangocms-admin-style - -(2) Add ``djangocms_admin_style`` to your ``INSTALLED_APPS`` just before - ``django.contrib.admin``. - -Install `fobi.contrib.themes.djangocms_admin_style_theme` theme -############################################################### -(1) Add ``fobi.contrib.themes.djangocms_admin_style_theme`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.themes.djangocms_admin_style_theme', - # ... - ) - -(2) Specify ``djangocms_admin_style_theme`` as a default theme in your - ``settings.py``: - - .. code-block:: python - - FOBI_DEFAULT_THEME = 'djangocms_admin_style_theme' - - -fobi.contrib.themes.foundation5 -------------------------------- -A ``django-fobi`` Foundation 5 theme. Based on the ??? template, but -entire JS and CSS are taken from Foundation 5 version 5.4.0. The -`following `_ icon set -was used. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.themes.foundation5`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.themes.foundation5', - # ... - ) - -(2) Specify ``foundation5`` as a default theme in your ``settings.py``: - - .. code-block:: python - - FOBI_DEFAULT_THEME = 'foundation5' - - -fobi.contrib.themes.simple --------------------------- -A ``django-fobi`` theme in a style of Django admin. Relies on Django-admin -and some jQuery UI only. - -jQuery UI "Django" theme comes from `here -`_. - -Installation -~~~~~~~~~~~~ -(1) Add ``fobi.contrib.themes.simple`` to the - ``INSTALLED_APPS`` in your ``settings.py``. - - .. code-block:: python - - INSTALLED_APPS = ( - # ... - 'fobi.contrib.themes.simple', - # ... - ) - -(2) Specify ``simple`` as a default theme in your ``settings.py``: - - .. code-block:: python - - FOBI_DEFAULT_THEME = 'simple' - - diff --git a/setup.py b/setup.py index 2526b6c2..c8ca498a 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import sys from distutils.version import LooseVersion from setuptools import setup, find_packages -version = '0.11.11' +version = '0.11.12' # *************************************************************************** # ************************** Python version ********************************* diff --git a/src/fobi/__init__.py b/src/fobi/__init__.py index 476ccc53..7f66a6be 100644 --- a/src/fobi/__init__.py +++ b/src/fobi/__init__.py @@ -1,6 +1,6 @@ __title__ = 'django-fobi' -__version__ = '0.11.11' -__build__ = 0x000086 +__version__ = '0.11.12' +__build__ = 0x000087 __author__ = 'Artur Barseghyan ' __copyright__ = '2014-2017 Artur Barseghyan' __license__ = 'GPL 2.0/LGPL 2.1' diff --git a/src/fobi/contrib/apps/drf_integration/TODOS.rst b/src/fobi/contrib/apps/drf_integration/TODOS.rst index 3a8b26e2..c5eea728 100644 --- a/src/fobi/contrib/apps/drf_integration/TODOS.rst +++ b/src/fobi/contrib/apps/drf_integration/TODOS.rst @@ -35,6 +35,11 @@ Must haves - Improve documentation. - Add more meta options for special fields, such as ``slider``. - Move DRF NoneField to the ``django-nonefield`` package (contrib). +- Add PhoneNumberField plugin. Most of the work on + (serializer) has already been done in the + `django-phonenumber-field + `_, so just make + use of it. Should haves ------------ diff --git a/src/fobi/contrib/apps/drf_integration/base.py b/src/fobi/contrib/apps/drf_integration/base.py index 7324fad8..52f074d2 100644 --- a/src/fobi/contrib/apps/drf_integration/base.py +++ b/src/fobi/contrib/apps/drf_integration/base.py @@ -36,7 +36,7 @@ LOGGER = logging.getLogger(__name__) class DRFIntegrationFormElementPluginProcessor( IntegrationFormElementPluginProcessor ): - """django-rest-framework field instance processor.""" + """Django REST framework field instance processor.""" def __init__(self, *args, **kwargs): super(DRFIntegrationFormElementPluginProcessor, self).__init__( @@ -45,6 +45,7 @@ class DRFIntegrationFormElementPluginProcessor( ) self.field_class = kwargs.get('field_class') self.field_kwargs = kwargs.get('field_kwargs', {}) + self.field_metadata = kwargs.get('field_metadata', {}) self.form_element_plugin = kwargs.get('form_element_plugin') self.data = self.form_element_plugin.data \ if self.form_element_plugin \ diff --git a/src/fobi/contrib/apps/drf_integration/dynamic.py b/src/fobi/contrib/apps/drf_integration/dynamic.py index 6b99bbed..63be0002 100644 --- a/src/fobi/contrib/apps/drf_integration/dynamic.py +++ b/src/fobi/contrib/apps/drf_integration/dynamic.py @@ -64,6 +64,7 @@ def get_declared_fields(form_entry, has_value=None): """Get declared fields.""" declared_fields = [] + declared_fields_metadata = [] if form_element_entries is None: form_element_entries = form_entry.formelemententry_set.all() @@ -88,17 +89,30 @@ def get_declared_fields(form_entry, ) for plugin_custom_field_instance \ in plugin_custom_field_instances: - # print(plugin_custom_field_instance.field_kwargs) - declared_fields.append( + + # The serializer field class + custom_field_class = plugin_custom_field_instance.field_class( + **plugin_custom_field_instance.field_kwargs + ) + + # Since serializer fields do not accept **kwargs, we need + # to assign `declared_fields_metadata` in the same way as we + # do with `declared_fields`. + declared_fields_metadata.append( ( plugin_custom_field_instance.data.name, - plugin_custom_field_instance.field_class( - **plugin_custom_field_instance.field_kwargs - ), + plugin_custom_field_instance.field_metadata ) ) - return OrderedDict(declared_fields) + declared_fields.append( + ( + plugin_custom_field_instance.data.name, + custom_field_class, + ) + ) + + return OrderedDict(declared_fields), OrderedDict(declared_fields_metadata) def assemble_serializer_class(form_entry, @@ -108,7 +122,8 @@ def assemble_serializer_class(form_entry, origin_return_func=None, form_element_entries=None, has_value=None, - declared_fields=None): + declared_fields=None, + declared_fields_metadata=None): """Assemble a serializer class by given entry. :param form_entry: @@ -164,7 +179,7 @@ def assemble_serializer_class(form_entry, # return DynamicSerializer if declared_fields is None: - declared_fields = get_declared_fields( + declared_fields, declared_fields_metadata = get_declared_fields( form_entry, origin=origin, origin_kwargs_update_func=origin_kwargs_update_func, @@ -199,9 +214,22 @@ def assemble_serializer_class(form_entry, return OrderedDict(fields) + @classmethod + def _get_declared_fields_metadata(cls, bases, attrs): + """Similar to _get_declared_fields, but for metadata.""" + fields = [ + (field_name, obj) for field_name, obj + in declared_fields_metadata.items() + if field_name not in attrs + ] + + return OrderedDict(fields) + def __new__(cls, name, bases, attrs): """Modified version of the original __new__.""" attrs['_declared_fields'] = cls._get_declared_fields(bases, attrs) + attrs['_declared_fields_metadata'] = \ + cls._get_declared_fields_metadata(bases, attrs) return super(SerializerMetaclass, cls).__new__(cls, name, bases, @@ -277,6 +305,19 @@ def assemble_serializer_class(form_entry, # serializer class. return copy.deepcopy(self._declared_fields) + def get_fields_metadata(self, field_name=None): + """ + Returns a dictionary of {field_name: field_instance}. + """ + # Every new serializer is created with a clone of the field + # instances. This allows users to dynamically modify the fields + # on a serializer instance without affecting every other + # serializer class. + fields_metadata = copy.deepcopy(self._declared_fields_metadata) + if field_name is not None: + return fields_metadata.get(field_name) + return fields_metadata + def get_validators(self): """ Returns a list of validator callables. diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/base.py index 50e4c89d..0b7fce2e 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image/base.py @@ -41,6 +41,7 @@ class ContentImagePlugin(IntegrationFormElementPlugin, """Get form field instances.""" rendered_image = form_element_plugin.get_rendered_image() + raw_data = form_element_plugin.get_raw_data() field_kwargs = { 'initial': rendered_image, @@ -48,12 +49,19 @@ class ContentImagePlugin(IntegrationFormElementPlugin, 'required': False, 'label': '', 'read_only': True, - 'raw_data': form_element_plugin.get_raw_data(), + 'raw_data': raw_data, + } + field_metadata = { + 'type': 'content', + 'contenttype': 'image', + 'content': rendered_image, + 'raw_data': raw_data } return [ DRFIntegrationFormElementPluginProcessor( field_class=ContentImageField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/base.py index 061205ec..f0a1f602 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_image_url/base.py @@ -41,6 +41,7 @@ class ContentImageURLPlugin(IntegrationFormElementPlugin, """Get form field instances.""" rendered_image = form_element_plugin.get_rendered_image() + raw_data = form_element_plugin.get_raw_data() field_kwargs = { 'initial': rendered_image, @@ -48,12 +49,19 @@ class ContentImageURLPlugin(IntegrationFormElementPlugin, 'required': False, 'label': '', 'read_only': True, - 'raw_data': form_element_plugin.get_raw_data(), + 'raw_data': raw_data, + } + field_metadata = { + 'type': 'content', + 'contenttype': 'image', + 'content': rendered_image, + 'raw_data': raw_data } return [ DRFIntegrationFormElementPluginProcessor( field_class=ContentImageField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/base.py index a419dca3..b84389cc 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_text/base.py @@ -41,19 +41,26 @@ class ContentTextPlugin(IntegrationFormElementPlugin, """Get form field instances.""" rendered_text = form_element_plugin.get_rendered_text() - + raw_data = form_element_plugin.get_raw_data() field_kwargs = { 'initial': rendered_text, 'default': rendered_text, 'required': False, 'label': '', 'read_only': True, - 'raw_data': form_element_plugin.get_raw_data(), + 'raw_data': raw_data, + } + field_metadata = { + 'type': 'content', + 'contenttype': 'text', + 'content': rendered_text, + 'raw_data': raw_data } return [ DRFIntegrationFormElementPluginProcessor( field_class=ContentTextField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/base.py index 612cb124..22f2b673 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/content/content_video/base.py @@ -40,6 +40,7 @@ class ContentVideoPlugin(IntegrationFormElementPlugin, **kwargs): """Get form field instances.""" rendered_video = form_element_plugin.get_rendered_video() + raw_data = form_element_plugin.get_raw_data() field_kwargs = { 'initial': rendered_video, @@ -47,12 +48,19 @@ class ContentVideoPlugin(IntegrationFormElementPlugin, 'required': False, 'label': '', 'read_only': True, - 'raw_data': form_element_plugin.get_raw_data(), + 'raw_data': raw_data, + } + field_metadata = { + 'type': 'content', + 'contenttype': 'video', + 'content': rendered_video, + 'raw_data': raw_data } return [ DRFIntegrationFormElementPluginProcessor( field_class=ContentVideoField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/decimal/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/decimal/base.py index 3d41e5c6..b92dfb26 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/decimal/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/decimal/base.py @@ -41,6 +41,9 @@ class DecimalInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } if form_element_plugin.data.initial: data_initial = decimal.Decimal( @@ -63,18 +66,23 @@ class DecimalInputPlugin(IntegrationFormFieldPlugin, if form_element_plugin.data.max_digits: data_max_digits = int(form_element_plugin.data.max_digits) field_kwargs.update({'max_digits': data_max_digits}) + field_metadata.update({'max_digits': data_max_digits}) else: field_kwargs.update({'max_digits': 10}) + field_metadata.update({'max_digits': 10}) if form_element_plugin.data.decimal_places: data_decimal_places = int(form_element_plugin.data.decimal_places) field_kwargs.update({'decimal_places': data_decimal_places}) + field_metadata.update({'decimal_places': data_decimal_places}) else: field_kwargs.update({'decimal_places': 5}) + field_metadata.update({'decimal_places': 5}) return [ DRFIntegrationFormElementPluginProcessor( field_class=DecimalField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/email/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/email/base.py index 4078ce08..1874cecf 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/email/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/email/base.py @@ -44,9 +44,15 @@ class EmailInputPlugin(IntegrationFormFieldPlugin, field_kwargs.update( {'max_length': int(form_element_plugin.data.max_length)} ) + + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } + return [ DRFIntegrationFormElementPluginProcessor( field_class=EmailField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/float/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/float/base.py index 57517b6d..1244f7d2 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/float/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/float/base.py @@ -39,6 +39,10 @@ class FloatInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } + if form_element_plugin.data.initial: field_kwargs['initial'] = float(form_element_plugin.data.initial) @@ -53,6 +57,7 @@ class FloatInputPlugin(IntegrationFormFieldPlugin, return [ DRFIntegrationFormElementPluginProcessor( field_class=FloatField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/input/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/input/base.py index 66aa3fa5..4259ce3c 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/input/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/input/base.py @@ -40,13 +40,59 @@ class InputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } + + if form_element_plugin.data.autocomplete_value: + field_metadata.update({'autocomplete': 'on'}) + + if form_element_plugin.data.autofocus_value: + field_metadata.update({'autofocus': 'autofocus'}) + + if form_element_plugin.data.disabled_value: + field_metadata.update({'disabled': 'disabled'}) + + if form_element_plugin.data.list_value: + field_metadata.update({'list': form_element_plugin.data.list_value}) + + if form_element_plugin.data.max_value: + field_metadata.update({'max': form_element_plugin.data.max_value}) + + if form_element_plugin.data.min_value: + field_metadata.update({'min': form_element_plugin.data.min_value}) + + if form_element_plugin.data.multiple_value: + field_metadata.update({'multiple': 'multiple'}) + + if form_element_plugin.data.pattern_value: + field_metadata.update( + {'pattern': form_element_plugin.data.pattern_value} + ) + + if form_element_plugin.data.readonly_value: + field_kwargs.update({'read_only': True}) + + if form_element_plugin.data.step_value: + field_metadata.update( + {'step': form_element_plugin.data.step_value} + ) + + if form_element_plugin.data.type_value \ + and form_element_plugin.data.type_value in ('submit', + 'button', + 'reset',): + field_metadata.update({'value': form_element_plugin.data.label}) + if form_element_plugin.data.max_length: field_kwargs.update( {'max_length': int(form_element_plugin.data.max_length)} ) + return [ DRFIntegrationFormElementPluginProcessor( field_class=CharField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/integer/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/integer/base.py index c1ace4e7..f38f89c1 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/integer/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/integer/base.py @@ -39,14 +39,26 @@ class IntegerInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } if form_element_plugin.data.initial: field_kwargs.update( {'initial': int(form_element_plugin.data.initial)} ) + if form_element_plugin.data.max_value: + data_max_value = int(form_element_plugin.data.max_value) + field_kwargs['max_value'] = data_max_value + + if form_element_plugin.data.min_value: + data_min_value = int(form_element_plugin.data.min_value) + field_kwargs['min_value'] = data_min_value return [ DRFIntegrationFormElementPluginProcessor( field_class=IntegerField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/ip_address/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/ip_address/base.py index 86a7c355..d01ccef9 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/ip_address/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/ip_address/base.py @@ -40,6 +40,9 @@ class IPAddressInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } if form_element_plugin.data.max_length: field_kwargs.update( {'max_length': int(form_element_plugin.data.max_length)} @@ -47,6 +50,7 @@ class IPAddressInputPlugin(IntegrationFormFieldPlugin, return [ DRFIntegrationFormElementPluginProcessor( field_class=IPAddressField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/password/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/password/base.py index 9e9c57dc..9e29d61e 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/password/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/password/base.py @@ -40,6 +40,9 @@ class PasswordInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } if form_element_plugin.data.max_length: field_kwargs.update( {'max_length': int(form_element_plugin.data.max_length)} @@ -48,6 +51,7 @@ class PasswordInputPlugin(IntegrationFormFieldPlugin, return [ DRFIntegrationFormElementPluginProcessor( field_class=CharField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/regex/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/regex/base.py index fd3adb13..0ba6cc8b 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/regex/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/regex/base.py @@ -41,12 +41,17 @@ class RegexInputPlugin(IntegrationFormFieldPlugin, 'help_text': form_element_plugin.data.help_text, 'regex': form_element_plugin.data.regex, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder, + 'regex': form_element_plugin.data.regex, + } if form_element_plugin.data.max_length: field_kwargs['max_length'] = form_element_plugin.data.max_length return [ DRFIntegrationFormElementPluginProcessor( field_class=RegexField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/slug/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/slug/base.py index 51ab2fe0..d6141c2c 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/slug/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/slug/base.py @@ -40,6 +40,9 @@ class SlugInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } if form_element_plugin.data.max_length: field_kwargs.update( {'max_length': int(form_element_plugin.data.max_length)} @@ -47,6 +50,7 @@ class SlugInputPlugin(IntegrationFormFieldPlugin, return [ DRFIntegrationFormElementPluginProcessor( field_class=SlugField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/text/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/text/base.py index 7141374e..20c1cd8a 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/text/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/text/base.py @@ -40,13 +40,18 @@ class TextInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } if form_element_plugin.data.max_length: field_kwargs.update({ 'max_length': int(form_element_plugin.data.max_length) }) + return [ DRFIntegrationFormElementPluginProcessor( field_class=CharField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/textarea/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/textarea/base.py index 6c2f8718..49959604 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/textarea/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/textarea/base.py @@ -40,9 +40,13 @@ class TextareaPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } return [ DRFIntegrationFormElementPluginProcessor( field_class=CharField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/form_elements/fields/url/base.py b/src/fobi/contrib/apps/drf_integration/form_elements/fields/url/base.py index cdb256e1..482de22e 100644 --- a/src/fobi/contrib/apps/drf_integration/form_elements/fields/url/base.py +++ b/src/fobi/contrib/apps/drf_integration/form_elements/fields/url/base.py @@ -40,6 +40,9 @@ class URLInputPlugin(IntegrationFormFieldPlugin, 'label': form_element_plugin.data.label, 'help_text': form_element_plugin.data.help_text, } + field_metadata = { + 'placeholder': form_element_plugin.data.placeholder + } if form_element_plugin.data.max_length: field_kwargs.update( {'max_length': int(form_element_plugin.data.max_length)} @@ -47,6 +50,7 @@ class URLInputPlugin(IntegrationFormFieldPlugin, return [ DRFIntegrationFormElementPluginProcessor( field_class=URLField, - field_kwargs=field_kwargs + field_kwargs=field_kwargs, + field_metadata=field_metadata ) ] diff --git a/src/fobi/contrib/apps/drf_integration/metadata.py b/src/fobi/contrib/apps/drf_integration/metadata.py index c1460b1e..ce9458d2 100644 --- a/src/fobi/contrib/apps/drf_integration/metadata.py +++ b/src/fobi/contrib/apps/drf_integration/metadata.py @@ -41,23 +41,18 @@ class FobiMetaData(SimpleMetadata): of metadata about it. """ field_info = super(FobiMetaData, self).get_field_info(field) - if isinstance( - field, - (ContentTextField, ContentImageField, ContentVideoField) - ): - field_info['type'] = 'content' - if isinstance(field, ContentTextField): - field_info['contenttype'] = 'text' - field_info['content'] = field.initial - field_info['raw'] = field.raw_data - elif isinstance(field, ContentImageField): - field_info['contenttype'] = 'image' - field_info['content'] = field.initial - field_info['raw'] = field.raw_data - else: - field_info['contenttype'] = 'video' - field_info['content'] = field.initial - field_info['raw'] = field.raw_data + for __key in ['initial', 'max_value', 'min_value']: + __val = getattr(field, __key, None) + if __val not in (None, ''): + field_info[__key] = __val + + field_metadata = field.root.get_fields_metadata().get( + field.field_name, {} + ) + if field_metadata: + for __k, __val in field_metadata.items(): + if __val not in (None, ''): + field_info[__k] = __val return field_info diff --git a/src/fobi/contrib/apps/drf_integration/serializers.py b/src/fobi/contrib/apps/drf_integration/serializers.py index 0eecbe54..6f0a7961 100644 --- a/src/fobi/contrib/apps/drf_integration/serializers.py +++ b/src/fobi/contrib/apps/drf_integration/serializers.py @@ -1,4 +1,6 @@ # from __future__ import unicode_literals +from collections import OrderedDict + from rest_framework import serializers from rest_framework.reverse import reverse @@ -42,3 +44,9 @@ class FormEntrySerializer(serializers.ModelSerializer): args=[obj.slug], request=self.context['request'] ) + + def get_fields_metadata(self, field_name=None): + """Just to make sure nothing breaks.""" + if field_name is not None: + return {} + return OrderedDict([]) diff --git a/src/fobi/contrib/apps/drf_integration/views.py b/src/fobi/contrib/apps/drf_integration/views.py index fb2335a1..51eb0eb5 100644 --- a/src/fobi/contrib/apps/drf_integration/views.py +++ b/src/fobi/contrib/apps/drf_integration/views.py @@ -76,7 +76,10 @@ class FobiFormEntryViewSet( # OK, calling this twice sucks, but fine for the time being. # In future we should try to get rid of additional queries # made double. - declared_fields = get_declared_fields(obj, has_value=self.has_value()) + declared_fields, declared_fields_metadata = get_declared_fields( + obj, + has_value=self.has_value() + ) # Setting all the fields, one by one like they were attributes of # the object (while they are obviously NOT). It's all done just to diff --git a/src/fobi/tests/data.py b/src/fobi/tests/data.py index e2160f69..646883d6 100644 --- a/src/fobi/tests/data.py +++ b/src/fobi/tests/data.py @@ -475,7 +475,8 @@ TEST_DYNAMIC_FORMS_DEFINITION_DATA = OrderedDict([ '"name": "username", ' '"required": true, ' '"max_length": 200, ' - '"label": "Username"' + '"label": "Username", ' + '"placeholder": "delusionalinsanity"' '}' ) ), @@ -597,7 +598,7 @@ FAKER = Faker() TEST_DYNAMIC_FORMS_PUT_DATA_ALL = { 'username': FAKER.user_name(), 'email': FAKER.email(), - 'age': FAKER.pyint(), + 'age': FAKER.random_int(min=0, max=200), 'drivers_license': FAKER.pybool(), 'special_fields': FAKER.pystr(), 'number_of_children': FAKER.pyint(), @@ -612,7 +613,8 @@ TEST_DYNAMIC_FORMS_OPTIONS_RESPONSE = OrderedDict([ (u'required', True), (u'read_only', False), (u'label', u'Username'), - (u'max_length', 200)])), + (u'max_length', 200), + (u'placeholder', 'delusionalinsanity')])), (u'email', OrderedDict([(u'type', u'email'), (u'required', True), (u'read_only', False), @@ -621,7 +623,8 @@ TEST_DYNAMIC_FORMS_OPTIONS_RESPONSE = OrderedDict([ (u'age', OrderedDict([(u'type', u'integer'), (u'required', True), (u'read_only', False), - (u'label', u'Age')])), + (u'label', u'Age'), + ('max_value', 200)])), (u'drivers_license', OrderedDict([(u'type', u'boolean'), (u'required', False), (u'read_only', False), From 2a93d142cee5577c43e50effea6dc2cef8a88448 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Thu, 1 Jun 2017 02:00:58 +0200 Subject: [PATCH 4/4] added exported test drf form --- examples/saved_forms_in_json_format/test-drf-form.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 examples/saved_forms_in_json_format/test-drf-form.json diff --git a/examples/saved_forms_in_json_format/test-drf-form.json b/examples/saved_forms_in_json_format/test-drf-form.json new file mode 100644 index 00000000..41239c7f --- /dev/null +++ b/examples/saved_forms_in_json_format/test-drf-form.json @@ -0,0 +1 @@ +{"form_elements": [{"plugin_data": "{\"placeholder\": \"\", \"min_value\": 1, \"required\": false, \"label\": \"Test integer\", \"help_text\": \"\", \"max_value\": 20, \"name\": \"test_integer\", \"initial\": 10}", "plugin_uid": "integer", "position": 1}, {"plugin_data": "{\"initial\": \"\", \"max_length\": 255, \"placeholder\": \"john@doe.com\", \"help_text\": \"Donec mollis hendrerit risus. Phasellus a est. Nam ipsum risus, rutrum vitae, vestibulum eu, molestie vel, lacus. Praesent nec nisl a purus blandit viverra. Cras id dui.\", \"label\": \"Test email\", \"name\": \"test_email\", \"required\": true}", "plugin_uid": "email", "position": 2}, {"plugin_data": "{\"initial\": \"\", \"max_length\": 255, \"placeholder\": \"Lorem ipsum dolor sit amet\", \"help_text\": \"Sed lectus. Phasellus gravida semper nisi. Curabitur at lacus ac velit ornare lobortis. Mauris turpis nunc, blandit et, volutpat molestie, porta ut, ligula. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\", \"label\": \"Test text\", \"name\": \"test_text\", \"required\": false}", "plugin_uid": "text", "position": 3}, {"plugin_data": "{\"initial\": \"http://github.com\", \"max_length\": 255, \"placeholder\": \"\", \"help_text\": \"\", \"label\": \"Test URL\", \"name\": \"test_url\", \"required\": false}", "plugin_uid": "url", "position": 4}, {"plugin_data": "{\"initial\": 10, \"required\": false, \"max_value\": 25, \"label\": \"Test decimal field\", \"decimal_places\": 2, \"name\": \"test_decimal_field\", \"placeholder\": \"3.14\", \"min_value\": 1, \"max_digits\": 5, \"help_text\": \"\"}", "plugin_uid": "decimal", "position": 5}, {"plugin_data": "{\"placeholder\": \"\", \"min_value\": 1.0, \"required\": false, \"label\": \"Test float field\", \"help_text\": \"\", \"max_value\": 10.0, \"name\": \"test_float_field\", \"initial\": 3.14}", "plugin_uid": "float", "position": 6}, {"plugin_data": "{\"placeholder\": \"127,0.0.1\", \"unpack_ipv4\": false, \"label\": \"Test IP address\", \"protocol\": \"ipv6\", \"help_text\": \"\", \"required\": false, \"name\": \"test_ip_address\", \"max_length\": 255, \"initial\": \"\"}", "plugin_uid": "ip_address", "position": 7}, {"plugin_data": "{\"placeholder\": \"your-secret-password\", \"label\": \"Test password field\", \"help_text\": \"\", \"required\": false, \"name\": \"test_password_field\", \"max_length\": 255, \"initial\": \"\"}", "plugin_uid": "password", "position": 8}, {"plugin_data": "{\"placeholder\": \"\", \"label\": \"Test regex field\", \"regex\": \"^([a-zA-Z])+$\", \"help_text\": \"\", \"required\": false, \"name\": \"test_regex_field\", \"max_length\": 255, \"initial\": \"\"}", "plugin_uid": "regex", "position": 9}, {"plugin_data": "{\"placeholder\": \"lorem-ipsum-dolor-sit-amet\", \"label\": \"Test slug field\", \"help_text\": \"\", \"required\": false, \"name\": \"test_slug_field\", \"max_length\": 255, \"initial\": \"\"}", "plugin_uid": "slug", "position": 10}, {"plugin_data": "{\"placeholder\": \"Pellentesque habitant morbi tristique.\", \"label\": \"Test textarea field\", \"help_text\": \"\", \"required\": false, \"name\": \"test_textarea_field\", \"initial\": \"\"}", "plugin_uid": "textarea", "position": 11}, {"plugin_data": "{\"pattern_value\": \"\", \"readonly_value\": true, \"autofocus_value\": true, \"type_value\": \"text\", \"autocomplete_value\": true, \"max_value\": \"\", \"name\": \"test_input_field\", \"step_value\": null, \"placeholder\": \"\", \"min_value\": \"\", \"multiple_value\": false, \"disabled_value\": true, \"label\": \"Test input field\", \"list_value\": \"\", \"help_text\": \"\", \"required\": false, \"max_length\": 255, \"initial\": \"\"}", "plugin_uid": "input", "position": 12}, {"plugin_data": "{\"alt\": \"n.n.\", \"fit_method\": \"fit_width\", \"size\": \"600x600\", \"url\": \"http://delusionalinsanity.com/foreverchild.for.cats/uploads/gallery/2012-11-22-9-1-22.jpg\"}", "plugin_uid": "content_image_url", "position": 14}, {"plugin_data": "{\"text\": \"Pellentesque posuere. Quisque id mi. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Phasellus a est. In turpis.\"}", "plugin_uid": "content_text", "position": 15}, {"plugin_data": "{\"title\": \"Delusional Insanity - To far beyond...\", \"size\": \"500x400\", \"url\": \"https://www.youtube.com/watch?v=8GVIui0JK0M&t=1s\"}", "plugin_uid": "content_video", "position": 16}], "form_handlers": [], "name": "Test DRF form", "is_cloneable": false, "success_page_message": "", "is_public": false, "success_page_title": "", "action": "", "slug": "test-drf-form"} \ No newline at end of file