django-fobi¶
django-fobi (or just fobi) is a customisable, modular, user- and developer- friendly form generator/builder application for Django. With fobi you can build Django forms using an intuitive GUI, save or mail posted form data or even export forms into JSON format and import them on other instances. API allows you to build your own form elements and form handlers (mechanisms for handling the submitted form data).
Prerequisites¶
- Django 1.5, 1.6, 1.7, 1.8, 1.9
- Python >= 2.6.8, >= 2.7, >= 3.3
Note, that Django 1.10 is not yet proclaimed to be flawlessly supported, however it’s in progress. The latest core and contrib packages (from master branch, with no additional dependencies) have been tested against the latest stable Django 1.10 release. All tests have successfully passed, although it’s yet too early to claim that Django 1.10 is fully supported.
Key concepts¶
- Each form consists of elements. Form elements are divided into two groups:
- form fields (input field, textarea, hidden field, file field, etc.).
- content (presentational) elements (text, image, embed video, etc.).
- Number of form elements is not limited.
- Each form may contain handlers. Handler processes the form data (for example, saves it or mails it). Number of the handlers is not limited.
- Both form elements and form handlers are made with Django permission system in mind.
- As an addition to form handlers, form callbacks are implemented. Form callbacks are fired on various stages of pre- and post-processing the form data (on POST). Form callbacks do not make use of permission system (unless you intentionally do so in the code of your callback) and are fired for all forms (unlike form handlers, that are executed only if assigned).
- Each plugin (form element or form handler) or a callback - is a Django micro-app.
Note, that django-fobi does not require django-admin and administrative
rights/permissions to access the UI, although almost seamless integration with
django-admin is implemented through the simple
theme.
Main features and highlights¶
- User-friendly GUI to quickly build forms.
- Large variety of Bundled form element plugins. Most of the Django fields are supported. HTML5 fields are supported as well.
- Anti-spam solutions like CAPTCHA, ReCAPTCHA or Honeypot come out of the box (CAPTCHA and ReCAPTCHA do require additional third-party apps to be installed).
- In addition to standard form elements, there are cosmetic (presentational) form elements (for adding a piece of text, image or a embed video) alongside standard form elements.
- Data handling in plugins (form handlers). Save the data, mail it to some address or repost it to some other endpoint. See the Bundled form handler plugins for more information.
- Developer-friendly API, which allows to edit existing or build new form fields and handlers without touching the core.
- Support for custom user model.
- Theming. There are 4 ready to use Bundled themes: “Bootstrap 3”, “Foundation 5”, “Simple” (with editing interface in style of Django admin) and “DjangoCMS admin style” theme (which is another simple theme with editing interface in style of djangocms-admin-style).
- Implemented integration with FeinCMS (in a form of a FeinCMS page widget).
- Implemented integration with DjangoCMS (in a form of a DjangoCMS page plugin).
- Implemented integration with Mezzanine (in a form of a Mezzanine page).
- Reordering of form elements using drag-n-drop.
- Data export (DB store form handler plugin) into XLS/CSV format.
- Dynamic initial values for form elements.
- Import/export forms to/from JSON format.
- Import forms from MailChimp using mailchimp importer.
Roadmap¶
Some of the upcoming/in-development features/improvements are:
- Integration with django-rest-framework (in version 0.8).
- Fieldsets (in version 0.9).
See the TODOS for the full list of planned-, pending- in-development- or to-be-implemented features.
Demo¶
Run demo locally¶
In order to be able to quickly evaluate the django-fobi, a demo app (with a quick installer) has been created (works on Ubuntu/Debian, may work on other Linux systems as well, although not guaranteed). Follow the instructions below for having the demo running within a minute.
Grab the latest django_fobi_example_app_installer.sh:
wget https://raw.github.com/barseghyanartur/django-fobi/stable/examples/django_fobi_example_app_installer.sh
Assign execute rights to the installer and run the django_fobi_example_app_installer.sh:
chmod +x django_fobi_example_app_installer.sh
./django_fobi_example_app_installer.sh
Open your browser and test the app.
Dashboard:
- URL: http://127.0.0.1:8001/fobi/
- Admin username: test_admin
- Admin password: test
Django admin interface:
- URL: http://127.0.0.1:8001/admin/
- Admin username: test_admin
- Admin password: test
If quick installer doesn’t work for you, see the manual steps on running the example project.
Quick start¶
See the quick start.
Installation¶
- Install latest stable version from PyPI:
pip install django-fobi
Or latest stable version from GitHub:
pip install -e git+https://github.com/barseghyanartur/django-fobi@stable#egg=django-fobi
Or latest stable version from BitBucket:
pip install -e hg+https://bitbucket.org/barseghyanartur/django-fobi@stable#egg=django-fobi
- Add fobi to
INSTALLED_APPS
of the your projects’ Django settings. Furthermore, all themes and plugins to be used, shall be added to theINSTALLED_APPS
as well. Note, that if a plugin has additional dependencies, you should be mentioning those in theINSTALLED_APPS
as well.
INSTALLED_APPS = (
# Used by fobi
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
# ...
# `django-fobi` core
'fobi',
# `django-fobi` themes
'fobi.contrib.themes.bootstrap3', # Bootstrap 3 theme
'fobi.contrib.themes.foundation5', # Foundation 5 theme
'fobi.contrib.themes.simple', # Simple theme
# `django-fobi` form elements - fields
'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.regex',
'fobi.contrib.plugins.form_elements.fields.select',
'fobi.contrib.plugins.form_elements.fields.select_model_object',
'fobi.contrib.plugins.form_elements.fields.select_multiple',
'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
'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',
# `django-fobi` form elements - content elements
'fobi.contrib.plugins.form_elements.test.dummy',
'easy_thumbnails', # Required by `content_image` plugin
'fobi.contrib.plugins.form_elements.content.content_image',
'fobi.contrib.plugins.form_elements.content.content_text',
'fobi.contrib.plugins.form_elements.content.content_video',
# `django-fobo` form handlers
'fobi.contrib.plugins.form_handlers.db_store',
'fobi.contrib.plugins.form_handlers.http_repost',
'fobi.contrib.plugins.form_handlers.mail',
# Other project specific apps
'foo', # Test app
# ...
)
- Make appropriate changes to the
TEMPLATE_CONTEXT_PROCESSORS
of the your projects’ Django settings.
And the following to the context processors.
TEMPLATE_CONTEXT_PROCESSORS = (
# ...
"fobi.context_processors.theme",
# ...
)
Make sure that django.core.context_processors.request
is in
TEMPLATE_CONTEXT_PROCESSORS
too.
- Configure URLs
Add the following line to urlpatterns of your urls module.
# View URLs
url(r'^fobi/', include('fobi.urls.view')),
# Edit URLs
url(r'^fobi/', include('fobi.urls.edit')),
Note, that some plugins require additional URL includes. For instance, if you
listed the fobi.contrib.plugins.form_handlers.db_store form handler plugin
in the INSTALLED_APPS
, you should mention the following in urls module.
# DB Store plugin URLs
url(r'^fobi/plugins/form-handlers/db-store/',
include('fobi.contrib.plugins.form_handlers.db_store.urls')),
View URLs are put separately from edit URLs in order to make it possible to prefix the edit URLs differently. For example, if you’re using the “Simple” theme, you would likely want to prefix the edit URLs with “admin/” so that it looks more like django-admin.
Creating a new form element plugin¶
Form element plugins represent the elements of which the forms is made: Inputs, checkboxes, textareas, files, hidden fields, as well as pure presentational elements (text or image). Number of form elements in a form is not limited.
Presentational form elements are inherited from fobi.base.FormElementPlugin
.
The rest (real form elements, that are supposed to have a value)
are inherited from fobi.base.FormFieldPlugin
.
You should see a form element plugin as a Django micro app, which could have its’ own models, admin interface, etc.
django-fobi comes with several bundled form element plugins. Do check the source code as example.
Let’s say, you want to create a textarea form element plugin.
There are several properties, each textarea should have. They are:
- label (string): HTML label of the textarea.
- name (string): HTML name of the textarea.
- initial (string): Initial value of the textarea.
- required (bool): Flag, which tells us whether the field is required or optional.
Let’s name that plugin sample_textarea. The plugin directory should then have the following structure.
path/to/sample_textarea/
├── __init__.py
├── fobi_form_elements.py # Where plugins are defined and registered
├── forms.py # Plugin configuration form
└── widgets.py # Where plugins widgets are defined
Form element plugins should be registered in “fobi_form_elements.py” file. Each
plugin module should be put into the INSTALLED_APPS
of your Django
projects’ settings.
In some cases, you would need plugin specific overridable settings (see
fobi.contrib.form_elements.fields.content.content_image
plugin as an
example). You are advised to write your settings in such a way, that variables
of your Django project settings module would have FOBI_PLUGIN_ prefix.
Define and register the form element plugin¶
Step by step review of a how to create and register a plugin and plugin
widgets. Note, that django-fobi auto-discovers your plugins if you place
them into a file named fobi_form_elements.py of any Django app listed in
INSTALLED_APPS
of your Django projects’ settings module.
path/to/sample_textarea/fobi_form_elements.py¶
A single form element plugin is registered by its’ UID.
Required imports.
from django import forms
from fobi.base import FormFieldPlugin, form_element_plugin_registry
from path.to.sample_textarea.forms import SampleTextareaForm
Defining the Sample textarea plugin.
class SampleTextareaPlugin(FormFieldPlugin):
uid = "sample_textarea"
name = "Sample Textarea"
form = SampleTextareaForm
group = "Samples" # Group to which the plugin belongs to
def get_form_field_instances(self, request=None):
kwargs = {
'required': self.data.required,
'label': self.data.label,
'initial': self.data.initial,
'widget': forms.widgets.Textarea(attrs={})
}
return [(self.data.name, forms.CharField, kwargs),]
Registering the SampleTextareaPlugin
plugin.
form_element_plugin_registry.register(SampleTextareaPlugin)
Note, that in case you want to define a pure presentational element, make use
of fobi.base.FormElementPlugin
for subclassing, instead of
fobi.base.FormFieldPlugin
.
See the source of the content plugins
(fobi.contrib.plugins.form_elements.content) as a an example.
For instance, the captcha
and honeypot
fields are implemented
as form elements (subclasses the fobi.base.FormElementPlugin
). The
db_store
form handler plugin does not save the form data of
those elements. If you want the form element data to be saved, do inherit
from fobi.base.FormFieldPlugin
.
Hidden form element plugins, should be also having set the is_hidden
property to True. By default it’s set to False. That makes the hidden
form elements to be rendered using as django.forms.widgets.TextInput
widget in edit mode. In the view mode, the original widget that you
assigned in your form element plugin would be used.
There might be cases, when you need to do additional handling of the data upon
the successful form submission. In such cases, you will need to define a
submit_plugin_form_data
method in the plugin, which accepts the
following arguments:
- form_entry (fobi.models.FormEntry): Form entry, which is being submitted.
- request (django.http.HttpRequest): The Django HTTP request.
- form (django.forms.Form): Form object (a valid one, which contains
the
cleaned_data
attribute).
Example (taken from fobi.contrib.plugins.form_elements.fields.file):
def submit_plugin_form_data(self, form_entry, request, form):
# Get the file path
file_path = form.cleaned_data.get(self.data.name, None)
if file_path:
# Handle the upload
saved_file = handle_uploaded_file(FILES_UPLOAD_DIR, file_path)
# Overwrite ``cleaned_data`` of the ``form`` with path to moved
# file.
form.cleaned_data[self.data.name] = "{0}{1}".format(
settings.MEDIA_URL, saved_file
)
# It's critically important to return the ``form`` with updated
# ``cleaned_data``
return form
In the example below, the original form is being modified. If you don’t want the original form to be modified, do not return anything.
Check the file form element plugin (fobi.contrib.plugins.form_elements.fields.file) for complete example.
path/to/sample_textarea/forms.py¶
Why to have another file for defining forms? Just to keep the code clean and less messy, although you could perfectly define all your plugin forms in the module fobi_form_elements.py, it’s recommended to keep it separate.
Take into consideration, that forms.py is not an autodiscovered file pattern. All your form element plugins should be registered in modules named fobi_form_elements.py.
Required imports.
from django import forms
from fobi.base import BasePluginForm
Form for for SampleTextareaPlugin
form element plugin.
class SampleTextareaForm(forms.Form, BasePluginForm):
plugin_data_fields = [
("name", ""),
("label", ""),
("initial", ""),
("required", False)
]
name = forms.CharField(label="Name", required=True)
label = forms.CharField(label="Label", required=True)
initial = forms.CharField(label="Initial", required=False)
required = forms.BooleanField(label="Required", required=False)
Note that although it’s not being checked in the code, but for form
field plugins the following fields should be present in the plugin
form (BasePluginForm
) and the form plugin (FormFieldPlugin
):
- name
In some cases, you might want to do something with the data
before it gets saved. For that purpose, save_plugin_data
method
has been introduced.
See the following example.
def save_plugin_data(self, request=None):
"""
Saving the plugin data and moving the file.
"""
file_path = self.cleaned_data.get('file', None)
if file_path:
saved_image = handle_uploaded_file(IMAGES_UPLOAD_DIR, file_path)
self.cleaned_data['file'] = saved_image
path/to/sample_textarea/widgets.py¶
Required imports.
from fobi.base import FormElementPluginWidget
Defining the base plugin widget.
class BaseSampleTextareaPluginWidget(FormElementPluginWidget):
# Same as ``uid`` value of the ``SampleTextareaPlugin``.
plugin_uid = "sample_textarea"
path/to/sample_layout/fobi_form_elements.py¶
Register in the registry (in some module which is for sure to be loaded; it’s handy to do it in the theme module).
Required imports.
from fobi.base import form_element_plugin_widget_registry
from path.to.sample_textarea.widgets import BaseSampleTextareaPluginWidget
Define the theme specific plugin.
class SampleTextareaPluginWidget(BaseSampleTextareaPluginWidget):
theme_uid = 'bootstrap3' # Theme for which the widget is loaded
media_js = ['sample_layout/js/fobi.plugins.form_elements.sample_textarea.js',]
media_css = ['sample_layout/css/fobi.plugins.form_elements.sample_textarea.css',]
Register the widget.
form_element_plugin_widget_registry.register(SampleTextareaPluginWidget)
Form element plugin final steps¶
Now, that everything is ready, make sure your plugin module is added to
INSTALLED_APPS
.
INSTALLED_APPS = (
# ...
'path.to.sample_textarea',
# ...
)
Afterwards, go to terminal and type the following command.
./manage.py fobi_sync_plugins
If your HTTP server is running, you would then be able to see the new plugin in the edit form interface.
Dashboard URL: http://127.0.0.1:8000/fobi/
Note, that you have to be logged in, in order to use the dashboard. If your
new plugin doesn’t appear, set the FOBI_DEBUG
to True in your Django’s
local settings module, re-run your code and check console for error
notifications.
Creating a new form handler plugin¶
Form handler plugins handle the form data. django-fobi comes with several
bundled form handler plugins, among which is the db_store
and mail
plugins, which are responsible for saving the submitted form data into the
database and mailing the data to recipients specified. Number of form handlers
in a form is not limited. Certain form handlers are not configurable (for
example the db_store
form handler isn’t), while others are (mail
,
http_repost
).
You should see a form handler as a Django micro app, which could have its’ own models, admin interface, etc.
By default, it’s possible to use a form handler plugin multiple times per form.
If you wish to allow form handler plugin to be used only once in a form,
set the allow_multiple
property of the plugin to False.
As said above, django-fobi comes with several bundled form handler plugins. Do check the source code as example.
Define and register the form handler plugin¶
Let’s name that plugin sample_mail. The plugin directory should then have the following structure.
path/to/sample_mail/
├── __init__.py
├── fobi_form_handlers.py # Where plugins are defined and registered
└── forms.py # Plugin configuration form
Form handler plugins should be registered in “fobi_form_handlers.py” file.
Each plugin module should be put into the INSTALLED_APPS
of your Django
projects’ settings.
path/to/sample_mail/fobi_form_handlers.py¶
A single form handler plugin is registered by its’ UID.
Required imports.
import json
from django.core.mail import send_mail
from fobi.base import FormHandlerPlugin, form_handler_plugin_registry
from path.to.sample_mail.forms import SampleMailForm
Defining the Sample mail handler plugin.
class SampleMailHandlerPlugin(FormHandlerPlugin):
uid = "sample_mail"
name = _("Sample mail")
form = SampleMailForm
def run(self, form_entry, request, form):
send_mail(
self.data.subject,
json.dumps(form.cleaned_data),
self.data.from_email,
[self.data.to_email],
fail_silently = True
)
Some form handlers are configurable, some others not. In order to
have a user friendly way of showing the form handler settings, what’s
sometimes needed, a plugin_data_repr
method has been introduced.
Simplest implementation of it would look as follows:
def plugin_data_repr(self):
"""
Human readable representation of plugin data.
:return string:
"""
return self.data.__dict__
path/to/sample_mail/forms.py¶
If plugin is configurable, it has configuration data. A single form may have
unlimited number of same plugins. Imagine, you want to have different subjects
and additional body texts for different user groups. You could then assign two
form handler mail
plugins to the form. Of course, saving the posted form
data many times does not make sense, but it’s up to the user. So, in case if
plugin is configurable, it should have a form.
Why to have another file for defining forms? Just to keep the code clean and less messy, although you could perfectly define all your plugin forms in the module fobi_form_handlers.py, it’s recommended to keep it separate.
Take into consideration, that forms.py is not an autodiscovered file pattern. All your form handler plugins should be registered in modules named fobi_form_handlers.py.
Required imports.
from django import forms
from django.utils.translation import ugettext_lazy as _
from fobi.base import BasePluginForm
Defining the form for Sample mail handler plugin.
class MailForm(forms.Form, BasePluginForm):
plugin_data_fields = [
("from_name", ""),
("from_email", ""),
("to_name", ""),
("to_email", ""),
("subject", ""),
("body", ""),
]
from_name = forms.CharField(label=_("From name"), required=True)
from_email = forms.EmailField(label=_("From email"), required=True)
to_name = forms.CharField(label=_("To name"), required=True)
to_email = forms.EmailField(label=_("To email"), required=True)
subject = forms.CharField(label=_("Subject"), required=True)
body = forms.CharField(label=_("Body"), required = False,
widget=forms.widgets.Textarea)
After the plugin has been processed, all its’ data is available in a
plugin_instance.data
container (for example,
plugin_instance.data.subject
or plugin_instance.data.from_name
).
Prioritise the execution order¶
Some form handlers shall be executed prior others. A good example of such, is
a combination of “mail” and “db_save” form handlers for the form. In case if
large files are posted, submission of form data would fail if “mail” plugin
would be executed after “db_save” has been executed. That’s why it’s possible
to prioritise that ordering in a FOBI_FORM_HANDLER_PLUGINS_EXECUTION_ORDER
setting variable.
If not specified or left empty, form handler plugins would be ran in the order
of discovery. All form handler plugins that are not listed in the
FORM_HANDLER_PLUGINS_EXECUTION_ORDER
, would be ran after the plugins that
are mentioned there.
FORM_HANDLER_PLUGINS_EXECUTION_ORDER = (
'http_repost',
'mail',
# The 'db_store' is left out intentionally, since it should
# be the last plugin to be executed.
)
Form handler plugin custom actions¶
By default, a single form handler plugin has at least a “delete” action. If plugin is configurable, it gets an “edit” action as well.
For some of your plugins, you may want to register a custom action. For example, the “db_store” plugin does have one, for showing a link to a listing page with saved form data for the form given.
For such cases, define a custom_actions
method in your form handler
plugin. That method shall return a list of triples. In each triple,
first value is the URL, second value is the title and the third value
is the icon of the URL.
The following example is taken from the “db_store” plugin.
def custom_actions(self):
"""
Adding a link to view the saved form enties.
:return iterable:
"""
return (
(
reverse('fobi.contrib.plugins.form_handlers.db_store.view_saved_form_data_entries'),
_("View entries"),
'glyphicon glyphicon-list'
),
)
Form handler plugin final steps¶
Do not forget to add the form handler plugin module to INSTALLED_APPS
.
INSTALLED_APPS = (
# ...
'path.to.sample_mail',
# ...
)
Afterwards, go to terminal and type the following command.
./manage.py fobi_sync_plugins
If your HTTP server is running, you would then be able to see the new plugin in the edit form interface.
Creating a new form importer plugin¶
Form importer plugins import the forms from some external data source into django-fobi form format. Number of form importers is not limited. Form importers are implemented in forms of wizards (since they may contain several steps).
You should see a form importer as a Django micro app, which could have its’ own models, admin interface, etc.
At the moment django-fobi comes with only one bundled form handler plugin,
which is the mailchimp_importer
, which is responsible for importing
existing MailChimp forms into django-fobi.
Define and register the form importer plugin¶
Let’s name that plugin sample_importer. The plugin directory should then have the following structure.
path/to/sample_importer/
├── templates
│ └── sample_importer
│ ├── 0.html
│ └── 1.html
├── __init__.py
├── fobi_form_importers.py # Where plugins are defined and registered
├── forms.py # Wizard forms
└── views.py # Wizard views
Form importer plugins should be registered in “fobi_form_importers.py” file.
Each plugin module should be put into the INSTALLED_APPS
of your Django
projects’ settings.
path/to/sample_importer/fobi_form_importers.py¶
A single form importer plugin is registered by its’ UID.
Required imports.
from django.utils.translation import ugettext_lazy as _
from fobi.form_importers import BaseFormImporter, form_importer_plugin_registry
from fobi.contrib.plugins.form_elements import fields
from path.to.sample_importer.views import SampleImporterWizardView
Defining the Sample importer plugin.
class SampleImporterPlugin(FormHandlerPlugin):
uid = 'sample_importer'
name = _("Sample importer)
wizard = SampleImporterWizardView
templates = [
'sample_importer/0.html',
'sample_importer/1.html',
]
# field_type (at importer): uid (django-fobi)
fields_mapping = {
# Implemented
'email': fields.email.UID,
'text': fields.text.UID,
'number': fields.integer.UID,
'dropdown': fields.select.UID,
'date': fields.date.UID,
'url': fields.url.UID,
'radio': fields.radio.UID,
# Transformed into something else
'address': fields.text.UID,
'zip': fields.text.UID,
'phone': fields.text.UID,
}
# Django standard: remote
field_properties_mapping = {
'label': 'name',
'name': 'tag',
'help_text': 'helptext',
'initial': 'default',
'required': 'req',
'choices': 'choices',
}
field_type_prop_name = 'field_type'
position_prop_name = 'order'
def extract_field_properties(self, field_data):
field_properties = {}
for prop, val in self.field_properties_mapping.items():
if val in field_data:
if 'choices' == val:
field_properties[prop] = "\n".join(field_data[val])
else:
field_properties[prop] = field_data[val]
return field_properties
form_importer_plugin_registry.register(SampleImporter)
path/to/sample_importer/forms.py¶
As mentioned above, form importers are implemented in form of wizards. The forms are the wizard steps.
Required imports.
from django import forms
from django.utils.translation import ugettext_lazy as _
from sample_service_api import sample_api # Just an imaginary API client
Defining the form for Sample importer plugin.
class SampleImporterStep1Form(forms.Form):
"""
First form the the wizard.
"""
api_key = forms.CharField(required=True)
class SampleImporterStep2Form(forms.Form):
"""
Second form of the wizard.
"""
list_id = forms.ChoiceField(required=True, choices=[])
def __init__(self, *args, **kwargs):
"""
"""
self._api_key = None
if 'api_key' in kwargs:
self._api_key = kwargs.pop('api_key', None)
super(SampleImporterStep2Form, self).__init__(*args, **kwargs)
if self._api_key:
client = sample_api.Api(self._api_key)
lists = client.lists.list()
choices = [(l['id'], l['name']) for l in lists['data']]
self.fields['list_id'].choices = choices
path/to/sample_importer/views.py¶
The wizard views.
Required imports.
from sample_service_api import sample_api # Just an imaginary API client
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
# For django LTE 1.8 import from `django.contrib.formtools.wizard.views`
from formtools.wizard.views import SessionWizardView
from path.to.sample_importer.forms import (
SampleImporterStep1Form, SampleImporterStep2Form
)
Defining the wizard view for Sample importer plugin.
class SampleImporterWizardView(SessionWizardView):
"""
"""
form_list = [SampleImporterStep1Form, SampleImporterStep2Form]
def get_form_kwargs(self, step):
"""
"""
if '1' == step:
data = self.get_cleaned_data_for_step('0') or {}
api_key = data.get('api_key', None)
return {'api_key': api_key}
return {}
def done(self, form_list, **kwargs):
# Merging cleaned data into one dict
cleaned_data = {}
for form in form_list:
cleaned_data.update(form.cleaned_data)
# Connecting to sample client API
client = sample_client.Api(cleaned_data['api_key'])
# Fetching the form data
form_data = client.lists.merge_vars(
id={'list_id': cleaned_data['list_id']}
)
# We need the first form only
try:
form_data = form_data['data'][0]
except Exception as err:
messages.warning(
self.request,
_('Selected form could not be imported due errors.')
)
return redirect(reverse('fobi.dashboard'))
# Actually, import the form
form_entry = self._form_importer.import_data(
{'name': form_data['name'], 'user': self.request.user},
form_data['merge_vars']
)
redirect_url = reverse(
'fobi.edit_form_entry', kwargs={'form_entry_id': form_entry.pk}
)
messages.info(
self.request,
_('Form {0} imported successfully.').format(form_data['name'])
)
return redirect("{0}".format(redirect_url))
Form importer plugin final steps¶
Do not forget to add the form importer plugin module to INSTALLED_APPS
.
INSTALLED_APPS = (
# ...
'path.to.sample_importer',
# ...
)
Afterwards, go to terminal and type the following command.
./manage.py fobi_sync_plugins
If your HTTP server is running, you would then be able to see the new plugin in the dashboard form interface (implemented in all bundled themes).
Creating a form callback¶
Form callbacks are additional hooks, that are executed on various stages of the form submission.
Let’s place the callback in the foo module. The plugin directory should then have the following structure.
path/to/foo/
├── __init__.py
└── fobi_form_callbacks.py # Where callbacks are defined and registered
See the callback example below.
Required imports.
from fobi.constants import (
CALLBACK_BEFORE_FORM_VALIDATION,
CALLBACK_FORM_VALID_BEFORE_SUBMIT_PLUGIN_FORM_DATA,
CALLBACK_FORM_VALID, CALLBACK_FORM_VALID_AFTER_FORM_HANDLERS,
CALLBACK_FORM_INVALID
)
from fobi.base import FormCallback, form_callback_registry
Define and register the callback
class SampleFooCallback(FormCallback):
stage = CALLBACK_FORM_VALID
def callback(self, form_entry, request, form):
print("Great! Your form is valid!")
form_callback_registry.register(SampleFooCallback)
Add the callback module to INSTALLED_APPS
.
INSTALLED_APPS = (
# ...
'path.to.foo',
# ...
)
Suggestions¶
Custom action for the form¶
Sometimes, you would want to specify a different action for the form.
Although it’s possible to define a custom form action (action
field
in the “Form properties” tab), you’re advised to use the http_repost
plugin instead, since then the form would be still validated locally
and only then the valid data, as is, would be sent to the desired
endpoint.
Take in mind, that if both cases, if CSRF protection is enabled on the endpoint, your post request would result an error.
When you want to customise too many things¶
django-fobi, with its’ flexible form elements, form handlers and form
callbacks is very customisable. However, there might be cases when you need to
override entire view to fit your needs. Take a look at the
FeinCMS integration
or DjangoCMS integration
as a good example of such. You may also want to compare the code from original
view fobi.views.view_form_entry
with the code from the widget to get a
better idea of what could be changed in your case. If need a good advice,
just ask me.
Theming¶
django-fobi comes with theming API. While there are several ready-to-use themes:
- “Bootstrap 3” theme
- “Foundation 5” theme
- “Simple” theme in (with editing interface in style of the Django admin)
- “DjangoCMS admin style” theme (which is another simple theme with editing interface in style of djangocms-admin-style)
Obviously, there are two sorts of views when it comes to editing and viewing the form.
- The “view-view”, when the form as it has been made is exposed to the site end- users/visitors.
- The “edit-view” (builder view), where the authorised users build their forms.
Both “Bootstrap 3” and “Foundation 5” themes are making use of the same style for both “view-view” and “edit-view” views.
Both “Simple” and “DjangoCMS admin style” themes are styling for the “edit-view” only. The “view-view” is pretty much blank, as shown on the one of the screenshots [2.6].
Have in mind, that creating a brand new theme could be time consuming. Instead, you are advised to extend existing themes or in the worst case, if too much customisation required, create your own themes based on existing ones (just copy the desired theme to your project directory and work it out further).
It’s possible to use different templates for all “view” and “edit” actions (see the source code of the “simple” theme). Both “Bootstrap 3” and “Foundation 5” themes look great. Although if you can’t use any of those, the “Simple” theme is the best start, since it looks just like django-admin.
Create a new theme¶
Let’s place the theme in the sample_theme module. The theme directory should then have the following structure.
path/to/sample_theme/
├── static
│ ├── css
│ │ └── sample_theme.css
│ └── js
│ └── sample_theme.js
├── templates
│ └── sample_theme
│ ├── _base.html
│ ├── add_form_element_entry.html
│ ├── ...
│ └── view_form_entry_ajax.html
├── __init__.py
├── fobi_form_elements.py
└── fobi_themes.py # Where themes are defined and registered
See the theme example below.
from django.utils.translation import ugettext_lazy as _
from fobi.base import BaseTheme, theme_registry
class SampleTheme(BaseTheme):
"""
Sample theme.
"""
uid = 'sample'
name = _("Sample")
media_css = (
'sample_theme/css/sample_theme.css',
'css/fobi.core.css',
)
media_js = (
'js/jquery-1.10.2.min.js',
'jquery-ui/js/jquery-ui-1.10.3.custom.min.js',
'js/jquery.slugify.js',
'js/fobi.core.js',
'sample_theme/js/sample_theme.js',
)
# Form element specific
form_element_html_class = 'form-control'
form_radio_element_html_class = 'radio'
form_element_checkbox_html_class = 'checkbox'
form_edit_form_entry_option_class = 'glyphicon glyphicon-edit'
form_delete_form_entry_option_class = 'glyphicon glyphicon-remove'
form_list_container_class = 'list-inline'
# Templates
master_base_template = 'sample_theme/_base.html'
base_template = 'sample_theme/base.html'
form_ajax = 'sample_theme/snippets/form_ajax.html'
form_snippet_template_name = 'sample_theme/snippets/form_snippet.html'
form_properties_snippet_template_name = 'sample_theme/snippets/form_properties_snippet.html'
messages_snippet_template_name = 'sample_theme/snippets/messages_snippet.html'
add_form_element_entry_template = 'sample_theme/add_form_element_entry.html'
add_form_element_entry_ajax_template = 'sample_theme/add_form_element_entry_ajax.html'
add_form_handler_entry_template = 'sample_theme/add_form_handler_entry.html'
add_form_handler_entry_ajax_template = 'sample_theme/add_form_handler_entry_ajax.html'
create_form_entry_template = 'sample_theme/create_form_entry.html'
create_form_entry_ajax_template = 'bootstrap3/create_form_entry_ajax.html'
dashboard_template = 'sample_theme/dashboard.html'
edit_form_element_entry_template = 'sample_theme/edit_form_element_entry.html'
edit_form_element_entry_ajax_template = 'sample_theme/edit_form_element_entry_ajax.html'
edit_form_entry_template = 'sample_theme/edit_form_entry.html'
edit_form_entry_ajax_template = 'sample_theme/edit_form_entry_ajax.html'
edit_form_handler_entry_template = 'sample_theme/edit_form_handler_entry.html'
edit_form_handler_entry_ajax_template = 'sample_theme/edit_form_handler_entry_ajax.html'
form_entry_submitted_template = 'sample_theme/form_entry_submitted.html'
form_entry_submitted_ajax_template = 'sample_theme/form_entry_submitted_ajax.html'
view_form_entry_template = 'sample_theme/view_form_entry.html'
view_form_entry_ajax_template = 'sample_theme/view_form_entry_ajax.html'
Registering the SampleTheme
plugin.
theme_registry.register(SampleTheme)
Sometimes you would want to attach additional properties to the theme in order to use them later in templates (remember, current theme object is always available in templates under name fobi_theme).
For such cases you would need to define a variable in your project’s settings
module, called FOBI_CUSTOM_THEME_DATA
. See the following code as example:
# `django-fobi` custom theme data for to be displayed in third party apps
# like `django-registraton`.
FOBI_CUSTOM_THEME_DATA = {
'bootstrap3': {
'page_header_html_class': '',
'form_html_class': 'form-horizontal',
'form_button_outer_wrapper_html_class': 'control-group',
'form_button_wrapper_html_class': 'controls',
'form_button_html_class': 'btn',
'form_primary_button_html_class': 'btn-primary pull-right',
},
'foundation5': {
'page_header_html_class': '',
'form_html_class': 'form-horizontal',
'form_button_outer_wrapper_html_class': 'control-group',
'form_button_wrapper_html_class': 'controls',
'form_button_html_class': 'radius button',
'form_primary_button_html_class': 'btn-primary',
},
'simple': {
'page_header_html_class': '',
'form_html_class': 'form-horizontal',
'form_button_outer_wrapper_html_class': 'control-group',
'form_button_wrapper_html_class': 'submit-row',
'form_button_html_class': 'btn',
'form_primary_button_html_class': 'btn-primary',
}
}
You would now be able to access the defined extra properties in templates as shown below.
<div class="{{ fobi_theme.custom_data.form_button_wrapper_html_class }}">
You likely would want to either remove the footer text or change it. Define
a variable in your project’s settings module, called FOBI_THEME_FOOTER_TEXT
.
See the following code as example:
FOBI_THEME_FOOTER_TEXT = gettext('© django-fobi example site 2014')
Below follow the properties of the theme:
base_edit
base_view
There are generic templates made in order to simplify theming. Some of them you would never need to override. Some others, you would likely want to.
Templates that you likely would want to re-write in your custom theme implementation are marked with three asterisks (***):
generic
├── snippets
│ ├── form_ajax.html
│ ├── form_edit_ajax.html
│ ├── *** form_properties_snippet.html
│ ├── *** form_snippet.html
│ ├── --- form_edit_snippet.html (does not exist in generic templates)
│ ├── --- form_view_snippet.html (does not exist in generic templates)
│ ├── form_view_ajax.html
│ └── messages_snippet.html
│
├── _base.html
├── add_form_element_entry.html
├── add_form_element_entry_ajax.html
├── add_form_handler_entry.html
├── add_form_handler_entry_ajax.html
├── base.html
├── create_form_entry.html
├── create_form_entry_ajax.html
├── *** dashboard.html
├── edit_form_element_entry.html
├── edit_form_element_entry_ajax.html
├── edit_form_entry.html
├── *** edit_form_entry_ajax.html
├── edit_form_handler_entry.html
├── edit_form_handler_entry_ajax.html
├── form_entry_submitted.html
├── *** form_entry_submitted_ajax.html
├── *** theme.html
├── view_form_entry.html
└── view_form_entry_ajax.html
From all of the templates listed above, the _base.html template is the most influenced by the Bootstrap 3 theme.
Make changes to an existing theme¶
As said above, making your own theme from scratch could be costly. Instead, you can override/reuse an existing one and change it to your needs with minimal efforts. See the override simple theme example. In order to see it in action, run the project with settings_override_simple_theme option:
./manage.py runserver --settings=settings_override_simple_theme
Details explained below.
Directory structure¶
override_simple_theme/
├── static
│ └── override_simple_theme
│ ├── css
│ │ └── override-simple-theme.css
│ └── js
│ └── override-simple-theme.js
│
├── templates
│ └── override_simple_theme
│ ├── snippets
│ │ └── form_ajax.html
│ └── base_view.html
├── __init__.py
└── fobi_themes.py # Where themes are defined and registered
fobi_themes.py¶
Overriding the “simple” theme.
__all__ = ('MySimpleTheme',)
from fobi.base import theme_registry
from fobi.contrib.themes.simple.fobi_themes import SimpleTheme
class MySimpleTheme(SimpleTheme):
html_classes = ['my-simple-theme',]
base_view_template = 'override_simple_theme/base_view.html'
form_ajax = 'override_simple_theme/snippets/form_ajax.html'
Register the overridden theme. Note, that it’s important to set the force argument to True, in order to override the original theme. Force can be applied only once (for an overridden element).
theme_registry.register(MySimpleTheme, force=True)
templates/override_simple_theme/base_view.html¶
{% extends "simple/base_view.html" %}
{% load static %}
{% block stylesheets %}
<link
href="{% static 'override_simple_theme/css/override-simple-theme.css' %}"
rel="stylesheet" media="all" />
{% endblock stylesheets %}
{% block main-wrapper %}
<div id="sidebar">
<h2>It's easy to override a theme!</h2>
</div>
{{ block.super }}
{% endblock main-wrapper %}
templates/override_simple_theme/snippets/form_ajax.html¶
{% extends "fobi/generic/snippets/form_ajax.html" %}
{% block form_html_class %}basic-grey{% endblock %}
Permissions¶
Plugin system allows administrators to specify the access rights to every plugin. django-fobi permissions are based on Django Users and User Groups. Access rights are manageable via Django admin (“/admin/fobi/formelement/”, “/admin/fobi/formhandler/”). If user doesn’t have the rights to access plugin, it doesn’t appear on his form even if has been added to it (imagine, you have once granted the right to use the news plugin to all users, but later on decided to limit it to Staff members group only). Note, that superusers have access to all plugins.
Plugin access rights management interface in Django admin
┌──────────────────────────┬───────────────────────┬───────────────────────┐
│ `Plugin` │ `Users` │ `Groups` │
├──────────────────────────┼───────────────────────┼───────────────────────┤
│ Text │ John Doe │ Form builder users │
├──────────────────────────┼───────────────────────┼───────────────────────┤
│ Textarea │ │ Form builder users │
├──────────────────────────┼───────────────────────┼───────────────────────┤
│ File │ Oscar, John Doe │ Staff members │
├──────────────────────────┼───────────────────────┼───────────────────────┤
│ URL │ │ Form builder users │
├──────────────────────────┼───────────────────────┼───────────────────────┤
│ Hidden │ │ Form builder users │
└──────────────────────────┴───────────────────────┴───────────────────────┘
Management commands¶
There are several management commands available.
- fobi_find_broken_entries. Find broken form element/handler entries that occur when some plugin which did exist in the system, no longer exists.
- fobi_sync_plugins. Should be ran each time a new plugin is being added to the django-fobi.
- fobi_update_plugin_data. A mechanism to update existing plugin data in
case if it had become invalid after a change in a plugin. In order for it
to work, each plugin should implement and
update
method, in which the data update happens.
Tuning¶
There are number of django-fobi settings you can override in the settings module of your Django project:
- FOBI_RESTRICT_PLUGIN_ACCESS (bool): If set to True, (Django) permission system for dash plugins is enabled. Defaults to True. Setting this to False makes all plugins available for all users.
- FOBI_DEFAULT_THEME (str): Active (default) theme UID. Defaults to “bootstrap3”.
- FORM_HANDLER_PLUGINS_EXECUTION_ORDER (list of tuples): Order in which the form handlers are executed. See the “Prioritise the execution order” section for details.
For tuning of specific contrib plugin, see the docs in the plugin directory.
Bundled plugins and themes¶
django-fobi ships with number of bundled form element- and form handler- plugins, as well as themes which are ready to be used as is.
Bundled form element plugins¶
Below a short overview of the form element plugins. See the README.rst file in directory of each plugin for details.
Fields¶
Fields marked with asterics (*) fall under the definition of text elements. It’s possible to provide Dynamic initial values for text elements.
- Boolean (checkbox)
- Date
- DateTime
- Date drop down (year, month, day selection drop-downs)
- Decimal
- Email*
- File
- Float
- Hidden*
- Password*
- Radio select (radio button)
- Input
- IP address*
- Integer
- Null boolean
- Select (drop-down)
- Select model object (drop-down)
- Select multiple (drop-down)
- Slug*
- Select multiple model objects (drop-down)
- Text*
- Textarea*
- Time
- URL*
Content/presentation¶
Content plugins are presentational plugins, that make your forms look more complete and content rich.
- Content image: Insert an image.
- Content text: Add text.
- Content video: Add an embed YouTube or Vimeo video.
Security¶
- CAPTCHA:
Captcha integration, requires
django-simple-captcha
package. - ReCAPTCHA:
Captcha integration, requires
django-recaptcha
package. - Honeypot: Anti-spam honeypot field.
Bundled form handler plugins¶
Below a short overview of the form handler plugins. See the README.rst file in directory of each plugin for details.
- DB store: Stores form data in a database.
- HTTP repost: Repost the POST request to another endpoint.
- Mail: Send the form data by email.
Bundled themes¶
Below a short overview of the themes. See the README.rst file in directory of each theme for details.
- Bootstrap 3: Bootstrap 3 theme.
- Foundation 5: Foundation 5 theme.
- Simple: Basic theme with form editing is in a style of Django admin.
- DjangoCMS admin style: Basic theme with form editing is in a style of djangocms-admin-style.
HTML5 fields¶
The following HTML5 fields are supported in corresponding bundled plugins:
- date
- datetime
- max
- min
- number
- url
- placeholder
- type
With the fobi.contrib.plugins.form_elements.fields.input support for HTML5 fields is extended to the following fields:
- autocomplete
- autofocus
- list
- multiple
- pattern
- step
Loading initial data using GET arguments¶
It’s possible to provide initial data for the form using the GET arguments.
In that case, along with the field values, you should be providing an additional argument named “fobi_initial_data”, which doesn’t have to hold a value. For example, if your form contains of fields named “email” and “age” and you want to provide initial values for those using GET arguments, you should be constructing your URL to the form as follows:
http://127.0.0.1:8001/fobi/view/test-form/?fobi_initial_data&email=test@example.com&age=19
Dynamic initial values¶
It’s possible to provide a dynamic initial value for any of the text elements. In order to do that, you should use the build-in context processor or make your own one. The only requirement is that you should store all values that should be exposes in the form as a dict for fobi_dynamic_values dictionary key. Beware, that passing the original request object might be unsafe in many ways. Currently, a stripped down version of the request object is being passed as a context variable.
TEMPLATE_CONTEXT_PROCESSORS = (
# ...
"fobi.context_processors.dynamic_values",
# ...
)
def dynamic_values(request):
return {
'fobi_dynamic_values': {
'request': StrippedRequest(request),
'now': datetime.datetime.now(),
'today': datetime.date.today(),
}
}
In your GUI, you should be refering to the initial values in the following way:
{{ request.path }} {{ now }} {{ today }}
Note, that you should not provide the fobi_dynamic_values. as a prefix. Currently, the following variables are available in the fobi.context_processors.dynamic_values context processor:
request: Stripped HttpRequest object.
request.path: A string representing the full path to the requested page, not including the scheme or domain.
request.get_full_path(): Returns the path, plus an appended query string, if applicable.
request.is_secure(): Returns True if the request is secure; that is, if it was made with HTTPS.
request.is_ajax(): Returns True if the request was made via an XMLHttpRequest, by checking the HTTP_X_REQUESTED_WITH header for the string ‘XMLHttpRequest’.
request.META: A stripped down standard Python dictionary containing the available HTTP headers.
- HTTP_ACCEPT_ENCODING: Acceptable encodings for the response.
- HTTP_ACCEPT_LANGUAGE: Acceptable languages for the response.
- HTTP_HOST: The HTTP Host header sent by the client.
- HTTP_REFERER: The referring page, if any.
- HTTP_USER_AGENT: The client’s user-agent string.
- QUERY_STRING: The query string, as a single (unparsed) string.
- REMOTE_ADDR: The IP address of the client.
request.user: Authenticated user.
- request.user.email:
- request.user.get_username(): Returns the username for the user. Since the User model can be swapped out, you should use this method instead of referencing the username attribute directly.
- request.user.get_full_name(): Returns the first_name plus the last_name, with a space in between.
- request.user.get_short_name(): Returns the first_name.
- request.user.is_anonymous():
now: datetime.datetime.now()
today: datetime.date.today()
Submitted form element plugins values¶
While some values of form element plugins are submitted as is, some others need additional processing. There are 3 types of behaviour taken into consideration:
- “val”: value is being sent as is.
- “repr”: (human readable) representation of the value is used.
- “mix”: mix of value as is and human readable representation.
The following plugins have been made configurable in such a way, that developers can choose the desired behaviour in projects’ settings:
FOBI_FORM_ELEMENT_CHECKBOX_SELECT_MULTIPLE_SUBMIT_VALUE_AS
FOBI_FORM_ELEMENT_RADIO_SUBMIT_VALUE_AS
FOBI_FORM_ELEMENT_SELECT_SUBMIT_VALUE_AS
FOBI_FORM_ELEMENT_SELECT_MULTIPLE_SUBMIT_VALUE_AS
FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_SUBMIT_VALUE_AS
FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MODEL_OBJECTS_SUBMIT_VALUE_AS
See the README.rst in each of the following plugins for more information.
Rendering forms using third-party libraries¶
You might want to render your forms using third-party libraries such as django-crispy-forms, django-floppyforms or other alternatives.
For that purpose you should override the “snippets/form_snippet.html” used by the theme you have chosen. Your template would then look similar to the one below (make sure to setup/configure your third-party form rendering library prior doing this).
Using django-crispy-forms¶
{% load crispy_forms_tags fobi_tags %}
{% block form_non_field_and_hidden_errors %}
{% get_form_hidden_fields_errors form as form_hidden_fields_errors %}
{% if form.non_field_errors or form_hidden_fields_errors %}
{% include fobi_theme.form_non_field_and_hidden_errors_snippet_template %}
{% endif %}
{% endblock form_non_field_and_hidden_errors %}
{% crispy form %}
Using django-floppyforms¶
{% load floppyforms fobi_tags %}
{% block form_non_field_and_hidden_errors %}
{% get_form_hidden_fields_errors form as form_hidden_fields_errors %}
{% if form.non_field_errors or form_hidden_fields_errors %}
{% include fobi_theme.form_non_field_and_hidden_errors_snippet_template %}
{% endif %}
{% endblock form_non_field_and_hidden_errors %}
{% form form %}
See how it’s done in the override simple theme example.
Import/export forms¶
There might be cases when you have django-fobi running on multiple instances and have already spend some time on making forms on one of the instances, and want to reuse those forms on another. You could of course re-create entire form in the GUI, but we can do better than that. It’s possible to export forms into JSON format and import the exported forms again. It’s preferable that you run both instances on the same versions of django-fobi, otherwise imports might break (although it might just work). There are two scenarios to deal with missing plugin errors, which you have don’t yet have full control of. If both instances have the same set of form element and form handler plugins imports should go smoothly. It is though possible to make an import ignoring missing form element and form handler plugins. You would get an appropriate notice about that, but import will continue leaving the broken plugin data out.
Available translations¶
English is the primary language.
Debugging¶
By default debugging is turned off. It means that broken form entries, which
are entries with broken data, that are not possible to be shown, are just
skipped. That’s safe in production. Although, you for sure would want to
see the broken entries in development. Set the FOBI_DEBUG
to True
in the settings.py
of your project in order to do so.
Most of the errors are logged (DEBUG). If you have written a plugin and it somehow doesn’t appear in the list of available plugins, do run the following management command since it not only syncs your plugins into the database, but also is a great way of checking for possible errors.
./manage.py fobi_sync_plugins
Run the following command in order to identify the broken plugins.
./manage.py fobi_find_broken_entries
If you have forms refering to form element- of form handler- plugins that are currently missing (not registered, removed, failed to load - thus there would be a risk that your form would’t be rendered properly/fully and the necessary data handling wouldn’t happen either) you will get an appropriate exception. Although it’s fine to get an instant error message about such failures in development, in production is wouldn’t look appropriate. Thus, there are two settings related to the non-existing (not-found) form element- and form handler- plugins.
- FOBI_DEBUG: Set this to True in your development environment anyway. Watch error logs closely.
- FOBI_FAIL_ON_MISSING_FORM_ELEMENT_PLUGINS: If you want no error to be shown in case of missing form element plugins, set this to False in your settings module. Default value is True.
- FOBI_FAIL_ON_MISSING_FORM_HANDLER_PLUGINS: If you want no error to be shown in case of missing form element handlers, set this to False in your settings module. Default value is True.
Troubleshooting¶
If you get a FormElementPluginDoesNotExist
or a
FormHandlerPluginDoesNotExist
exception, make sure you have listed your
plugin in the settings module of your project.
License¶
GPL 2.0/LGPL 2.1
Support¶
For any issues contact me at the e-mail given in the Author section.
Author¶
Artur Barseghyan <artur.barseghyan@gmail.com>
Screenshots¶
Bootstrap3 theme¶
View/edit form¶
Form elements¶
[1.3] | Edit form - form elements tab active, no elements yet |

[1.4] | Edit form - form elements tab active, add a form element menu |

[1.5] | Edit form - add a form element (URL plugin) |

[1.6] | Edit form - form elements tab active, with form elements |

Form handlers¶
[1.7] | Edit form - form handlers tab active, no handlers yet |

[1.8] | Edit form - form handlers tab tactive, add form handler menu |

[1.9] | Edit form - add a form handler (Mail plugin) |

[1.10] | Edit form - form handlers tab active, with form handlers |

[1.11] | Edit form - form properties tab active |

[1.12] | View form |

[1.13] | View form - form submitted (thanks page) |

[1.14] | Edit form - add a form element (Video plugin) |

[1.15] | Edit form - add a form element (Boolean plugin) |

[1.16] | Edit form |

[1.17] | View form |

Simple theme¶
View/edit form¶
[2.1] | Edit form - form elements tab active, with form elements |

[2.2] | Edit form - form elements tab active, add a form element menu |

[2.3] | Edit form - add a form element (Hidden plugin) |

[2.4] | Edit form - form handlers tab active, with form handlers |

[2.5] | Edit form - form properties tab active |

[2.6] | View form |

Documentation¶
Contents:
fobi package¶
Subpackages¶
fobi.contrib package¶
Subpackages¶
-
fobi.contrib.apps.djangocms_integration.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.apps.djangocms_integration
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
- WIDGET_FORM_SENT (str): Name of the GET param indicating that form has been successfully sent.
-
fobi.contrib.apps.feincms_integration.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.apps.feincms_integration
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
- WIDGET_FORM_SENT_GET_PARAM (str): Name of the GET param indicating that form has been successfully sent.
-
class
fobi.contrib.apps.feincms_integration.widgets.
FobiFormWidget
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
,fobi.integration.processors.IntegrationProcessor
Widget for to FeinCMS.
Property fobi.models.FormEntry form_entry: Form entry to be rendered. Property str template: If given used for rendering the form. -
FobiFormWidget.
can_redirect
= True¶
-
FobiFormWidget.
form_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FobiFormWidget.
form_entry_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
form_sent_get_param
= 'sent'¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
form_template_name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
form_title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
get_form_template_name_display
(*moreargs, **morekwargs)¶
-
FobiFormWidget.
get_success_page_template_name_display
(*moreargs, **morekwargs)¶
-
FobiFormWidget.
hide_form_title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
hide_success_page_title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
process
(request, **kwargs)[source]¶ This is where most of the form handling happens.
Parameters: request (django.http.HttpRequest) – Return django.http.HttpResponse | str:
-
FobiFormWidget.
success_page_template_name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
success_page_text
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FobiFormWidget.
success_page_title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
fobi.contrib.apps.mezzanine_integration.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.apps.mezzanine_integration
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
- WIDGET_FORM_SENT_GET_PARAM (str): Name of the GET param indicating that form has been successfully sent.
-
fobi.contrib.plugins.form_elements.content.content_image.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.plugins.form_elements.content.content_image
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.content.content_image.fobi_form_elements.
ContentImagePlugin
(user=None)[source]¶ Bases:
fobi.base.FormElementPlugin
Content image plugin.
-
clone_plugin_data
(entry)[source]¶ Clone plugin data.
Clone plugin data, which means we make a copy of the original image.
TODO: Perhaps rely more on data of
form_element_entry
?
-
form
¶ alias of
ContentImageForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'content_image'¶
-
-
class
fobi.contrib.plugins.form_elements.content.content_image.forms.
ContentImageForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BasePluginForm
Form for
ContentImagePlugin
.-
base_fields
= OrderedDict([('file', <django.forms.fields.ImageField object at 0x7f383a2147d0>), ('alt', <django.forms.fields.CharField object at 0x7f383a214810>), ('fit_method', <django.forms.fields.ChoiceField object at 0x7f383a2148d0>), ('size', <django.forms.fields.ChoiceField object at 0x7f383a214990>)])¶
-
declared_fields
= OrderedDict([('file', <django.forms.fields.ImageField object at 0x7f383a2147d0>), ('alt', <django.forms.fields.CharField object at 0x7f383a214810>), ('fit_method', <django.forms.fields.ChoiceField object at 0x7f383a2148d0>), ('size', <django.forms.fields.ChoiceField object at 0x7f383a214990>)])¶
-
media
¶
-
plugin_data_fields
= [('file', ''), ('alt', ''), ('fit_method', 'center'), ('size', '500x500')]¶
-
-
fobi.contrib.plugins.form_elements.content.content_image.helpers.
handle_uploaded_file
(image_file)[source]¶ Handle uploaded file.
Parameters: image_file (django.core.files.uploadedfile.InMemoryUploadedFile) – Return string: Path to the image (relative).
-
fobi.contrib.plugins.form_elements.content.content_image.helpers.
get_crop_filter
(fit_method)[source]¶ Get crop filter.
-
fobi.contrib.plugins.form_elements.content.content_image.helpers.
delete_file
(image_file)[source]¶ Delete file from disc.
FIT_METHOD_CROP_SMART
(string)FIT_METHOD_CROP_CENTER
(string)FIT_METHOD_CROP_SCALE
(string)FIT_METHOD_FIT_WIDTH
(string)FIT_METHOD_FIT_HEIGHT
(string)DEFAULT_FIT_METHOD
(string)FIT_METHODS_CHOICES
(tuple)FIT_METHODS_CHOICES_WITH_EMPTY_OPTION
(list)IMAGES_UPLOAD_DIR
(string)
-
class
fobi.contrib.plugins.form_elements.content.content_text.fobi_form_elements.
ContentTextPlugin
(user=None)[source]¶ Bases:
fobi.base.FormElementPlugin
Content text plugin.
-
form
¶ alias of
ContentTextForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'content_text'¶
-
-
class
fobi.contrib.plugins.form_elements.content.content_text.forms.
ContentTextForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BasePluginForm
Form for
ContentTextPlugin
.-
base_fields
= OrderedDict([('text', <django.forms.fields.CharField object at 0x7f383a214750>)])¶
-
declared_fields
= OrderedDict([('text', <django.forms.fields.CharField object at 0x7f383a214750>)])¶
-
media
¶
-
plugin_data_fields
= [('text', '')]¶
-
-
fobi.contrib.plugins.form_elements.content.content_video.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.plugins.form_elements.content.content_video
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.content.content_video.fobi_form_elements.
ContentVideoPlugin
(user=None)[source]¶ Bases:
fobi.base.FormElementPlugin
Content video plugin.
-
form
¶ alias of
ContentVideoForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'content_video'¶
-
-
class
fobi.contrib.plugins.form_elements.content.content_video.forms.
ContentVideoForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BasePluginForm
Form for
ContentVideoPlugin
.-
base_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7f383a2144d0>), ('url', <django.forms.fields.CharField object at 0x7f383a214590>), ('size', <django.forms.fields.ChoiceField object at 0x7f383a214650>)])¶
-
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7f383a2144d0>), ('url', <django.forms.fields.CharField object at 0x7f383a214590>), ('size', <django.forms.fields.ChoiceField object at 0x7f383a214650>)])¶
-
media
¶
-
plugin_data_fields
= [('title', ''), ('url', ''), ('size', '500x400')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.boolean.fobi_form_elements.
BooleanSelectPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Boolean select plugin.
-
form
¶ alias of
BooleanSelectForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'boolean'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_plugins_form_elements_fields_checkbox_select_multiple'¶
-
name
= 'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple'¶
-
-
fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple.fobi_form_elements.
CheckboxSelectMultipleInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Checkbox select multiple field plugin.
-
form
¶ alias of
CheckboxSelectMultipleInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'checkbox_select_multiple'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple.forms.
CheckboxSelectMultipleInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
CheckboxSelectMultipleInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a198a10>), ('name', <django.forms.fields.CharField object at 0x7f383a198a50>), ('choices', <django.forms.fields.CharField object at 0x7f383a198b50>), ('help_text', <django.forms.fields.CharField object at 0x7f383a198c10>), ('initial', <django.forms.fields.CharField object at 0x7f383a198cd0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a198d90>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a198a10>), ('name', <django.forms.fields.CharField object at 0x7f383a198a50>), ('choices', <django.forms.fields.CharField object at 0x7f383a198b50>), ('help_text', <django.forms.fields.CharField object at 0x7f383a198c10>), ('initial', <django.forms.fields.CharField object at 0x7f383a198cd0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a198d90>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('choices', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.date.fobi_form_elements.
DateInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Date field plugin.
-
form
¶ alias of
DateInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'date'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.date.forms.
DateInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
DateInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1984d0>), ('name', <django.forms.fields.CharField object at 0x7f383a198510>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1985d0>), ('initial', <django.forms.fields.DateField object at 0x7f383a198690>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a198750>), ('required', <django.forms.fields.BooleanField object at 0x7f383a198810>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1984d0>), ('name', <django.forms.fields.CharField object at 0x7f383a198510>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1985d0>), ('initial', <django.forms.fields.DateField object at 0x7f383a198690>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a198750>), ('required', <django.forms.fields.BooleanField object at 0x7f383a198810>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('input_formats', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.date.widgets.
BaseDatePluginWidget
(plugin)[source]¶ Bases:
fobi.base.FormElementPluginWidget
Base date form element plugin widget.
-
plugin_uid
= 'date'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.date_drop_down.fobi_form_elements.
DateDropDownInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Date drop down field plugin.
-
form
¶ alias of
DateDropDownInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'date_drop_down'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.date_drop_down.forms.
DateDropDownInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
DateDropDownInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a18cd90>), ('name', <django.forms.fields.CharField object at 0x7f383a18cdd0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a18ce90>), ('year_min', <django.forms.fields.IntegerField object at 0x7f383a18cf50>), ('year_max', <django.forms.fields.IntegerField object at 0x7f383a198050>), ('initial', <django.forms.fields.CharField object at 0x7f383a198110>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a1981d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a198290>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a18cd90>), ('name', <django.forms.fields.CharField object at 0x7f383a18cdd0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a18ce90>), ('year_min', <django.forms.fields.IntegerField object at 0x7f383a18cf50>), ('year_max', <django.forms.fields.IntegerField object at 0x7f383a198050>), ('initial', <django.forms.fields.CharField object at 0x7f383a198110>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a1981d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a198290>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('year_min', ''), ('year_max', ''), ('initial', ''), ('input_formats', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.datetime.fobi_form_elements.
DateTimeInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
DateTime field plugin.
-
form
¶ alias of
DateTimeInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'datetime'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.datetime.forms.
DateTimeInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
DateTimeInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a18c890>), ('name', <django.forms.fields.CharField object at 0x7f383a18c8d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a18c990>), ('initial', <django.forms.fields.DateTimeField object at 0x7f383a18ca50>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a18cb10>), ('required', <django.forms.fields.BooleanField object at 0x7f383a18cbd0>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a18c890>), ('name', <django.forms.fields.CharField object at 0x7f383a18c8d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a18c990>), ('initial', <django.forms.fields.DateTimeField object at 0x7f383a18ca50>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a18cb10>), ('required', <django.forms.fields.BooleanField object at 0x7f383a18cbd0>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('input_formats', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.datetime.widgets.
BaseDateTimePluginWidget
(plugin)[source]¶ Bases:
fobi.base.FormElementPluginWidget
Base datetime form element plugin widget.
-
plugin_uid
= 'datetime'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.decimal.fobi_form_elements.
DecimalInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Decimal input plugin.
-
form
¶ alias of
DecimalInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'decimal'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.decimal.forms.
DecimalInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
DecimalInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a180e90>), ('name', <django.forms.fields.CharField object at 0x7f383a180ed0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a180f90>), ('initial', <django.forms.fields.DecimalField object at 0x7f383a18c090>), ('max_digits', <django.forms.fields.IntegerField object at 0x7f383a18c190>), ('decimal_places', <django.forms.fields.IntegerField object at 0x7f383a18c250>), ('min_value', <django.forms.fields.DecimalField object at 0x7f383a18c310>), ('max_value', <django.forms.fields.DecimalField object at 0x7f383a18c410>), ('required', <django.forms.fields.BooleanField object at 0x7f383a18c510>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a18c5d0>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a180e90>), ('name', <django.forms.fields.CharField object at 0x7f383a180ed0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a180f90>), ('initial', <django.forms.fields.DecimalField object at 0x7f383a18c090>), ('max_digits', <django.forms.fields.IntegerField object at 0x7f383a18c190>), ('decimal_places', <django.forms.fields.IntegerField object at 0x7f383a18c250>), ('min_value', <django.forms.fields.DecimalField object at 0x7f383a18c310>), ('max_value', <django.forms.fields.DecimalField object at 0x7f383a18c410>), ('required', <django.forms.fields.BooleanField object at 0x7f383a18c510>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a18c5d0>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_digits', ''), ('decimal_places', ''), ('min_value', None), ('max_value', None), ('required', False), ('placeholder', '')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.email.fobi_form_elements.
EmailInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Email input plugin.
-
form
¶ alias of
EmailInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'email'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.email.forms.
EmailInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
EmailInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a180810>), ('name', <django.forms.fields.CharField object at 0x7f383a180850>), ('help_text', <django.forms.fields.CharField object at 0x7f383a180910>), ('initial', <django.forms.fields.EmailField object at 0x7f383a1809d0>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a180a90>), ('required', <django.forms.fields.BooleanField object at 0x7f383a180b50>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a180c10>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a180810>), ('name', <django.forms.fields.CharField object at 0x7f383a180850>), ('help_text', <django.forms.fields.CharField object at 0x7f383a180910>), ('initial', <django.forms.fields.EmailField object at 0x7f383a1809d0>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a180a90>), ('required', <django.forms.fields.BooleanField object at 0x7f383a180b50>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a180c10>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_length', '255'), ('required', False), ('placeholder', '')]¶
-
-
fobi.contrib.plugins.form_elements.fields.file.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.plugins.form_elements.fields.conf
module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.file.fobi_form_elements.
FileInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
File field plugin.
-
form
¶ alias of
FileInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process file upload.
Handling the posted data for file plugin when form is submitted. This method affects the original form and that’s why it returns it.
Parameters: - form_entry (fobi.models.FormEntry) – Instance
of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance
of
-
uid
= 'file'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.file.forms.
FileInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
FileInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a180210>), ('name', <django.forms.fields.CharField object at 0x7f383a180250>), ('help_text', <django.forms.fields.CharField object at 0x7f383a180310>), ('initial', <django.forms.fields.CharField object at 0x7f383a1803d0>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a180490>), ('required', <django.forms.fields.BooleanField object at 0x7f383a180550>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a180210>), ('name', <django.forms.fields.CharField object at 0x7f383a180250>), ('help_text', <django.forms.fields.CharField object at 0x7f383a180310>), ('initial', <django.forms.fields.CharField object at 0x7f383a1803d0>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a180490>), ('required', <django.forms.fields.BooleanField object at 0x7f383a180550>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_length', '255'), ('required', False)]¶
-
FILES_UPLOAD_DIR
(string)
-
class
fobi.contrib.plugins.form_elements.fields.float.fobi_form_elements.
FloatInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Float input plugin.
-
form
¶ alias of
FloatInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'float'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.float.forms.
FloatInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
FloatInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a176b10>), ('name', <django.forms.fields.CharField object at 0x7f383a176b50>), ('help_text', <django.forms.fields.CharField object at 0x7f383a176c10>), ('initial', <django.forms.fields.FloatField object at 0x7f383a176cd0>), ('min_value', <django.forms.fields.FloatField object at 0x7f383a176d90>), ('max_value', <django.forms.fields.FloatField object at 0x7f383a176e50>), ('required', <django.forms.fields.BooleanField object at 0x7f383a176f10>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a176fd0>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a176b10>), ('name', <django.forms.fields.CharField object at 0x7f383a176b50>), ('help_text', <django.forms.fields.CharField object at 0x7f383a176c10>), ('initial', <django.forms.fields.FloatField object at 0x7f383a176cd0>), ('min_value', <django.forms.fields.FloatField object at 0x7f383a176d90>), ('max_value', <django.forms.fields.FloatField object at 0x7f383a176e50>), ('required', <django.forms.fields.BooleanField object at 0x7f383a176f10>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a176fd0>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('min_value', None), ('max_value', None), ('required', False), ('placeholder', '')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.input.fobi_form_elements.
InputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Input field plugin.
-
form
¶ alias of
InputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'input'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.input.forms.
InputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
InputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a16d590>), ('name', <django.forms.fields.CharField object at 0x7f383a16d5d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a16d690>), ('initial', <django.forms.fields.CharField object at 0x7f383a16d750>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a16d810>), ('required', <django.forms.fields.BooleanField object at 0x7f383a16d8d0>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a16d990>), ('autocomplete_value', <django.forms.fields.BooleanField object at 0x7f383a16da50>), ('autofocus_value', <django.forms.fields.BooleanField object at 0x7f383a16db10>), ('disabled_value', <django.forms.fields.BooleanField object at 0x7f383a16dbd0>), ('list_value', <django.forms.fields.CharField object at 0x7f383a16dcd0>), ('max_value', <django.forms.fields.CharField object at 0x7f383a16de10>), ('min_value', <django.forms.fields.CharField object at 0x7f383a16df10>), ('multiple_value', <django.forms.fields.BooleanField object at 0x7f383a176050>), ('pattern_value', <django.forms.fields.CharField object at 0x7f383a176110>), ('readonly_value', <django.forms.fields.BooleanField object at 0x7f383a176250>), ('step_value', <django.forms.fields.IntegerField object at 0x7f383a176310>), ('type_value', <django.forms.fields.ChoiceField object at 0x7f383a176450>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a16d590>), ('name', <django.forms.fields.CharField object at 0x7f383a16d5d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a16d690>), ('initial', <django.forms.fields.CharField object at 0x7f383a16d750>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a16d810>), ('required', <django.forms.fields.BooleanField object at 0x7f383a16d8d0>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a16d990>), ('autocomplete_value', <django.forms.fields.BooleanField object at 0x7f383a16da50>), ('autofocus_value', <django.forms.fields.BooleanField object at 0x7f383a16db10>), ('disabled_value', <django.forms.fields.BooleanField object at 0x7f383a16dbd0>), ('list_value', <django.forms.fields.CharField object at 0x7f383a16dcd0>), ('max_value', <django.forms.fields.CharField object at 0x7f383a16de10>), ('min_value', <django.forms.fields.CharField object at 0x7f383a16df10>), ('multiple_value', <django.forms.fields.BooleanField object at 0x7f383a176050>), ('pattern_value', <django.forms.fields.CharField object at 0x7f383a176110>), ('readonly_value', <django.forms.fields.BooleanField object at 0x7f383a176250>), ('step_value', <django.forms.fields.IntegerField object at 0x7f383a176310>), ('type_value', <django.forms.fields.ChoiceField object at 0x7f383a176450>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_length', '255'), ('required', False), ('placeholder', ''), ('autocomplete_value', 'off'), ('autofocus_value', False), ('disabled_value', False), ('list_value', ''), ('max_value', ''), ('min_value', ''), ('multiple_value', False), ('pattern_value', ''), ('readonly_value', False), ('step_value', ''), ('type_value', 'text')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.integer.fobi_form_elements.
IntegerInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Integer input plugin.
-
form
¶ alias of
IntegerInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'integer'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.integer.forms.
IntegerInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
IntegerInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a161e50>), ('name', <django.forms.fields.CharField object at 0x7f383a161e90>), ('help_text', <django.forms.fields.CharField object at 0x7f383a161f50>), ('initial', <django.forms.fields.IntegerField object at 0x7f383a16d050>), ('min_value', <django.forms.fields.IntegerField object at 0x7f383a16d110>), ('max_value', <django.forms.fields.IntegerField object at 0x7f383a16d1d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a16d290>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a16d350>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a161e50>), ('name', <django.forms.fields.CharField object at 0x7f383a161e90>), ('help_text', <django.forms.fields.CharField object at 0x7f383a161f50>), ('initial', <django.forms.fields.IntegerField object at 0x7f383a16d050>), ('min_value', <django.forms.fields.IntegerField object at 0x7f383a16d110>), ('max_value', <django.forms.fields.IntegerField object at 0x7f383a16d1d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a16d290>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a16d350>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('min_value', None), ('max_value', None), ('required', False), ('placeholder', '')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.ip_address.fobi_form_elements.
IPAddressInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
IP address field plugin.
-
form
¶ alias of
IPAddressInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'ip_address'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.null_boolean.fobi_form_elements.
NullBooleanSelectPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Null boolean select plugin.
-
form
¶ alias of
NullBooleanSelectForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'null_boolean'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.password.fobi_form_elements.
PasswordInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Password field plugin.
-
form
¶ alias of
PasswordInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'password'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.password.forms.
PasswordInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
PasswordInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1d6890>), ('name', <django.forms.fields.CharField object at 0x7f383a1d68d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1d6990>), ('initial', <django.forms.fields.CharField object at 0x7f383a1d6a50>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1d6b10>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1d6bd0>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1d6c90>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1d6890>), ('name', <django.forms.fields.CharField object at 0x7f383a1d68d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1d6990>), ('initial', <django.forms.fields.CharField object at 0x7f383a1d6a50>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1d6b10>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1d6bd0>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1d6c90>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_length', '255'), ('required', False), ('placeholder', '')]¶
-
-
fobi.contrib.plugins.form_elements.fields.radio.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi.contrib.plugins.form_elements.fields.radio conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.radio.fobi_form_elements.
RadioInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Radio field plugin.
-
form
¶ alias of
RadioInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'radio'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.radio.forms.
RadioInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
RadioInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1d6210>), ('name', <django.forms.fields.CharField object at 0x7f383a1d6250>), ('choices', <django.forms.fields.CharField object at 0x7f383a1d6350>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1d6410>), ('initial', <django.forms.fields.CharField object at 0x7f383a1d64d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1d6590>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1d6210>), ('name', <django.forms.fields.CharField object at 0x7f383a1d6250>), ('choices', <django.forms.fields.CharField object at 0x7f383a1d6350>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1d6410>), ('initial', <django.forms.fields.CharField object at 0x7f383a1d64d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1d6590>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('choices', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.regex.fobi_form_elements.
RegexInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Regex field plugin.
-
form
¶ alias of
RegexInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'regex'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.regex.forms.
RegexInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
RegexInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1ca950>), ('name', <django.forms.fields.CharField object at 0x7f383a1ca990>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1caa50>), ('regex', <django.forms.fields.RegexField object at 0x7f383a1cab50>), ('initial', <django.forms.fields.CharField object at 0x7f383a1cac90>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1cad50>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1cae10>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1caed0>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1ca950>), ('name', <django.forms.fields.CharField object at 0x7f383a1ca990>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1caa50>), ('regex', <django.forms.fields.RegexField object at 0x7f383a1cab50>), ('initial', <django.forms.fields.CharField object at 0x7f383a1cac90>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1cad50>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1cae10>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1caed0>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('regex', ''), ('max_length', '255'), ('required', False), ('placeholder', '')]¶
-
-
fobi.contrib.plugins.form_elements.fields.select.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi.contrib.plugins.form_elements.fields.select conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.select.fobi_form_elements.
SelectInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Select field plugin.
-
form
¶ alias of
SelectInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'select'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.select.forms.
SelectInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
SelectInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1ca350>), ('name', <django.forms.fields.CharField object at 0x7f383a1ca390>), ('choices', <django.forms.fields.CharField object at 0x7f383a1ca490>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1ca550>), ('initial', <django.forms.fields.CharField object at 0x7f383a1ca610>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1ca6d0>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1ca350>), ('name', <django.forms.fields.CharField object at 0x7f383a1ca390>), ('choices', <django.forms.fields.CharField object at 0x7f383a1ca490>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1ca550>), ('initial', <django.forms.fields.CharField object at 0x7f383a1ca610>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1ca6d0>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('choices', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
fobi.contrib.plugins.form_elements.fields.select_model_object.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi.contrib.plugins.form_elements.fields.select_model_object conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.select_model_object.fobi_form_elements.
SelectModelObjectInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Select model object field plugin.
-
form
¶ alias of
SelectModelObjectInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'select_model_object'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.select_model_object.forms.
SelectModelObjectInputForm
(*args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
SelectModelObjectPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1bee10>), ('name', <django.forms.fields.CharField object at 0x7f383a1bee50>), ('model', <django.forms.fields.ChoiceField object at 0x7f383a1bef10>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1befd0>), ('initial', <django.forms.fields.CharField object at 0x7f383a1ca0d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1ca190>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1bee10>), ('name', <django.forms.fields.CharField object at 0x7f383a1bee50>), ('model', <django.forms.fields.ChoiceField object at 0x7f383a1bef10>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1befd0>), ('initial', <django.forms.fields.CharField object at 0x7f383a1ca0d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1ca190>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('model', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.select_mptt_model_object.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_plugins_form_elements_fields_select_mptt_model_object'¶
-
name
= 'fobi.contrib.plugins.form_elements.fields.select_mptt_model_object'¶
-
-
fobi.contrib.plugins.form_elements.fields.select_mptt_model_object.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi.contrib.plugins.form_elements.fields.select_mptt_model_object conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.select_mptt_model_object.forms.
SelectMPTTModelObjectInputForm
(*args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
SelectMPTTModelObjectPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f38370b01d0>), ('name', <django.forms.fields.CharField object at 0x7f3837166d90>), ('model', <django.forms.fields.ChoiceField object at 0x7f3837166510>), ('help_text', <django.forms.fields.CharField object at 0x7f3837166d10>), ('initial', <django.forms.fields.CharField object at 0x7f38371668d0>), ('required', <django.forms.fields.BooleanField object at 0x7f3837166bd0>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f38370b01d0>), ('name', <django.forms.fields.CharField object at 0x7f3837166d90>), ('model', <django.forms.fields.ChoiceField object at 0x7f3837166510>), ('help_text', <django.forms.fields.CharField object at 0x7f3837166d10>), ('initial', <django.forms.fields.CharField object at 0x7f38371668d0>), ('required', <django.forms.fields.BooleanField object at 0x7f3837166bd0>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('model', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
fobi.contrib.plugins.form_elements.fields.select_multiple.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi.contrib.plugins.form_elements.fields.select_multiple conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.select_multiple.fobi_form_elements.
SelectMultipleInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Select multiple field plugin.
-
form
¶ alias of
SelectMultipleInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'select_multiple'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.select_multiple.forms.
SelectMultipleInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
SelectMultipleInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1be810>), ('name', <django.forms.fields.CharField object at 0x7f383a1be850>), ('choices', <django.forms.fields.CharField object at 0x7f383a1be950>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1bea10>), ('initial', <django.forms.fields.CharField object at 0x7f383a1bead0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1beb90>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1be810>), ('name', <django.forms.fields.CharField object at 0x7f383a1be850>), ('choices', <django.forms.fields.CharField object at 0x7f383a1be950>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1bea10>), ('initial', <django.forms.fields.CharField object at 0x7f383a1bead0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1beb90>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('choices', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_plugins_form_elements_fields_select_multiple_model_objects'¶
-
name
= 'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects'¶
-
-
fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects.fobi_form_elements.
SelectMultipleModelObjectsInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Select multiple model objects field plugin.
-
form
¶ alias of
SelectMultipleModelObjectsInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'select_multiple_model_objects'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects.forms.
SelectMultipleModelObjectsInputForm
(*args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
SelectMultipleModelObjectsPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1b3c10>), ('name', <django.forms.fields.CharField object at 0x7f383a1b3c50>), ('model', <django.forms.fields.ChoiceField object at 0x7f383a1b3d10>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1b3dd0>), ('initial', <django.forms.fields.CharField object at 0x7f383a1b3e90>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1b3f50>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1b3c10>), ('name', <django.forms.fields.CharField object at 0x7f383a1b3c50>), ('model', <django.forms.fields.ChoiceField object at 0x7f383a1b3d10>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1b3dd0>), ('initial', <django.forms.fields.CharField object at 0x7f383a1b3e90>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1b3f50>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('model', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_plugins_form_elements_fields_select_multiple_mptt_model_objects'¶
-
name
= 'fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects'¶
-
-
fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects.conf.
get_setting
(setting, override=None)[source]¶ Get a setting from fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_ objects conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.fields.select_multiple_mptt_model_objects.forms.
SelectMultipleMPTTModelObjectsInputForm
(*args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
SelectMultipleMPTTModelObjectsPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f38373a5990>), ('name', <django.forms.fields.CharField object at 0x7f38373a5450>), ('model', <django.forms.fields.ChoiceField object at 0x7f38373a57d0>), ('help_text', <django.forms.fields.CharField object at 0x7f38373a5d10>), ('initial', <django.forms.fields.CharField object at 0x7f38373a5f50>), ('required', <django.forms.fields.BooleanField object at 0x7f38373a5210>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f38373a5990>), ('name', <django.forms.fields.CharField object at 0x7f38373a5450>), ('model', <django.forms.fields.ChoiceField object at 0x7f38373a57d0>), ('help_text', <django.forms.fields.CharField object at 0x7f38373a5d10>), ('initial', <django.forms.fields.CharField object at 0x7f38373a5f50>), ('required', <django.forms.fields.BooleanField object at 0x7f38373a5210>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('model', ''), ('help_text', ''), ('initial', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.slug.fobi_form_elements.
SlugInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Slug field plugin.
-
form
¶ alias of
SlugInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'slug'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.slug.forms.
SlugInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
SlugInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1b3690>), ('name', <django.forms.fields.CharField object at 0x7f383a1b36d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1b3790>), ('initial', <django.forms.fields.SlugField object at 0x7f383a1b3850>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1b3910>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1b39d0>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1b3a90>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1b3690>), ('name', <django.forms.fields.CharField object at 0x7f383a1b36d0>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1b3790>), ('initial', <django.forms.fields.SlugField object at 0x7f383a1b3850>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1b3910>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1b39d0>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1b3a90>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_length', '255'), ('required', False), ('placeholder', '')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.text.fobi_form_elements.
TextInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Text field plugin.
-
form
¶ alias of
TextInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'text'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.text.forms.
TextInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
TextInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1b3110>), ('name', <django.forms.fields.CharField object at 0x7f383a1b3150>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1b3210>), ('initial', <django.forms.fields.CharField object at 0x7f383a1b32d0>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1b3390>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1b3450>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1b3510>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1b3110>), ('name', <django.forms.fields.CharField object at 0x7f383a1b3150>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1b3210>), ('initial', <django.forms.fields.CharField object at 0x7f383a1b32d0>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1b3390>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1b3450>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1b3510>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_length', '255'), ('required', False), ('placeholder', '')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.textarea.forms.
TextareaForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
TextareaPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1a4bd0>), ('name', <django.forms.fields.CharField object at 0x7f383a1a4c10>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1a4cd0>), ('initial', <django.forms.fields.CharField object at 0x7f383a1a4d90>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1a4e50>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1a4f10>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1a4bd0>), ('name', <django.forms.fields.CharField object at 0x7f383a1a4c10>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1a4cd0>), ('initial', <django.forms.fields.CharField object at 0x7f383a1a4d90>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1a4e50>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1a4f10>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('required', False), ('placeholder', '')]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.time.fobi_form_elements.
TimeInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
Time field plugin.
-
form
¶ alias of
TimeInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data/process.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'time'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.time.forms.
TimeInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
TimeInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1a46d0>), ('name', <django.forms.fields.CharField object at 0x7f383a1a4710>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1a47d0>), ('initial', <django.forms.fields.TimeField object at 0x7f383a1a4890>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a1a4950>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1a4a10>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1a46d0>), ('name', <django.forms.fields.CharField object at 0x7f383a1a4710>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1a47d0>), ('initial', <django.forms.fields.TimeField object at 0x7f383a1a4890>), ('input_formats', <django.forms.fields.CharField object at 0x7f383a1a4950>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1a4a10>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('input_formats', ''), ('required', False)]¶
-
-
class
fobi.contrib.plugins.form_elements.fields.url.fobi_form_elements.
URLInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormFieldPlugin
URL input plugin.
-
form
¶ alias of
URLInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'url'¶
-
-
class
fobi.contrib.plugins.form_elements.fields.url.forms.
URLInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
URLPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1a4150>), ('name', <django.forms.fields.CharField object at 0x7f383a1a4190>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1a4250>), ('initial', <django.forms.fields.URLField object at 0x7f383a1a4310>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1a43d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1a4490>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1a4550>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a1a4150>), ('name', <django.forms.fields.CharField object at 0x7f383a1a4190>), ('help_text', <django.forms.fields.CharField object at 0x7f383a1a4250>), ('initial', <django.forms.fields.URLField object at 0x7f383a1a4310>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a1a43d0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a1a4490>), ('placeholder', <django.forms.fields.CharField object at 0x7f383a1a4550>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('initial', ''), ('max_length', '255'), ('required', False), ('placeholder', '')]¶
-
-
class
fobi.contrib.plugins.form_elements.security.captcha.fobi_form_elements.
CaptchaInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormElementPlugin
Captcha field plugin.
-
form
¶ alias of
CaptchaInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'captcha'¶
-
-
class
fobi.contrib.plugins.form_elements.security.captcha.forms.
CaptchaInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
CaptchaInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f38376989d0>), ('name', <django.forms.fields.CharField object at 0x7f3837698b10>), ('help_text', <django.forms.fields.CharField object at 0x7f38376986d0>), ('required', <django.forms.fields.BooleanField object at 0x7f3837246590>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f38376989d0>), ('name', <django.forms.fields.CharField object at 0x7f3837698b10>), ('help_text', <django.forms.fields.CharField object at 0x7f38376986d0>), ('required', <django.forms.fields.BooleanField object at 0x7f3837246590>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('required', True)]¶
-
-
fobi.contrib.plugins.form_elements.security.honeypot.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.plugins.form_elements.security.honeypot
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_elements.security.honeypot.fields.
HoneypotField
(max_length=None, min_length=None, strip=True, *args, **kwargs)[source]¶ Bases:
django.forms.fields.CharField
-
default_error_messages
= {'invalid': <django.utils.functional.__proxy__ object at 0x7f383a285110>}¶
-
widget
¶ alias of
HiddenInput
-
-
class
fobi.contrib.plugins.form_elements.security.honeypot.fobi_form_elements.
HoneypotInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormElementPlugin
Honeypot field plugin.
-
form
¶ alias of
HoneypotInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'honeypot'¶
-
-
class
fobi.contrib.plugins.form_elements.security.honeypot.forms.
HoneypotInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
HoneypotInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a214d10>), ('name', <django.forms.fields.CharField object at 0x7f383a214d50>), ('initial', <django.forms.fields.CharField object at 0x7f383a214e10>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a214ed0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a214f90>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f383a214d10>), ('name', <django.forms.fields.CharField object at 0x7f383a214d50>), ('initial', <django.forms.fields.CharField object at 0x7f383a214e10>), ('max_length', <django.forms.fields.IntegerField object at 0x7f383a214ed0>), ('required', <django.forms.fields.BooleanField object at 0x7f383a214f90>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('initial', ''), ('max_length', '255'), ('required', True)]¶
-
HONEYPOT_VALUE
(string)
-
class
fobi.contrib.plugins.form_elements.security.recaptcha.fobi_form_elements.
ReCaptchaInputPlugin
(user=None)[source]¶ Bases:
fobi.base.FormElementPlugin
ReCaptcha field plugin.
-
form
¶ alias of
ReCaptchaInputForm
-
group
= <django.utils.functional.__proxy__ object>¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'recaptcha'¶
-
-
class
fobi.contrib.plugins.form_elements.security.recaptcha.forms.
ReCaptchaInputForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BaseFormFieldPluginForm
Form for
ReCaptchaInputPlugin
.-
base_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f3837779a10>), ('name', <django.forms.fields.CharField object at 0x7f383773b310>), ('help_text', <django.forms.fields.CharField object at 0x7f383773b910>), ('required', <django.forms.fields.BooleanField object at 0x7f383773be90>)])¶
-
declared_fields
= OrderedDict([('label', <django.forms.fields.CharField object at 0x7f3837779a10>), ('name', <django.forms.fields.CharField object at 0x7f383773b310>), ('help_text', <django.forms.fields.CharField object at 0x7f383773b910>), ('required', <django.forms.fields.BooleanField object at 0x7f383773be90>)])¶
-
media
¶
-
plugin_data_fields
= [('label', ''), ('name', ''), ('help_text', ''), ('required', True)]¶
-
-
class
fobi.contrib.plugins.form_elements.test.dummy.widgets.
BaseDummyPluginWidget
(plugin)[source]¶ Bases:
fobi.base.FormElementPluginWidget
Base dummy form element plugin widget.
-
plugin_uid
= 'dummy'¶
-
-
class
fobi.contrib.plugins.form_handlers.db_store.admin.
SavedFormDataEntryAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
Saved form data entry admin.
-
class
Media
[source]¶ Media class.
-
js
= ('/static/js/jquery-1.10.2.min.js', '/static/db_store/js/db_store.js', '/static/db_store/js/jquery.expander.min.js')¶
-
-
class
SavedFormDataEntryAdmin.
Meta
[source]¶ Meta class.
-
app_label
= <django.utils.functional.__proxy__ object>¶
-
-
SavedFormDataEntryAdmin.
actions
= ['export_data']¶
-
SavedFormDataEntryAdmin.
fieldsets
= ((None, {'fields': ('form_entry', 'user')}), (<django.utils.functional.__proxy__ object at 0x7f383a14a6d0>, {'fields': ('formatted_saved_data', 'created')}), (<django.utils.functional.__proxy__ object at 0x7f383a14a950>, {'fields': ('form_data_headers', 'saved_data'), 'classes': ('collapse',)}))¶
-
SavedFormDataEntryAdmin.
get_queryset
(request)¶ Get queryset.
Used internally.
-
SavedFormDataEntryAdmin.
list_display
= ('form_entry', 'user', 'formatted_saved_data', 'created')¶
-
SavedFormDataEntryAdmin.
list_filter
= ('form_entry', 'user')¶
-
SavedFormDataEntryAdmin.
media
¶
-
SavedFormDataEntryAdmin.
readonly_fields
= ('created', 'formatted_saved_data')¶
-
class
-
fobi.contrib.plugins.form_handlers.db_store.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.plugins.form_handlers.db_store
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_handlers.db_store.fobi_form_handlers.
DBStoreHandlerPlugin
(user=None)[source]¶ Bases:
fobi.base.FormHandlerPlugin
DB store form handler plugin.
Can be used only once per form.
-
allow_multiple
= False¶
-
custom_actions
(form_entry, request=None)[source]¶ Custom actions.
Adding a link to view the saved form entries.
Return iterable:
-
name
= <django.utils.functional.__proxy__ object>¶
-
run
(form_entry, request, form, form_element_entries=None)[source]¶ Run.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_element_entries (iterable) – Iterable of
fobi.models.FormElementEntry
objects.
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'db_store'¶
-
-
class
fobi.contrib.plugins.form_handlers.db_store.models.
SavedFormDataEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Saved form data.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
SavedFormDataEntry.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
SavedFormDataEntry.
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
SavedFormDataEntry.
form_data_headers
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
SavedFormDataEntry.
form_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
SavedFormDataEntry.
form_entry_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
SavedFormDataEntry.
formatted_saved_data
()[source]¶ Shows the formatted saved data records.
Return string:
-
SavedFormDataEntry.
get_next_by_created
(*moreargs, **morekwargs)¶
-
SavedFormDataEntry.
get_previous_by_created
(*moreargs, **morekwargs)¶
-
SavedFormDataEntry.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
SavedFormDataEntry.
objects
= <django.db.models.manager.Manager object>¶
-
SavedFormDataEntry.
saved_data
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
SavedFormDataEntry.
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
SavedFormDataEntry.
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
CSV_DELIMITER
(string)CSV_QUOTECHAR
(string)
-
fobi.contrib.plugins.form_handlers.db_store.views.
view_saved_form_data_entries
(request, *args, **kwargs)[source]¶ View saved form data entries.
Parameters: - request (django.http.HttpRequest) –
- form_entry_id (int) – Form ID.
- theme (fobi.base.BaseTheme) – Subclass of
fobi.base.BaseTheme
. - template_name (string) –
Return django.http.HttpResponse:
-
class
fobi.contrib.plugins.form_handlers.db_store.widgets.
BaseDbStorePluginWidget
(plugin)[source]¶ Bases:
fobi.base.FormHandlerPluginWidget
Base dummy form element plugin widget.
-
export_entries_icon_class
= 'glyphicon glyphicon-export'¶
-
plugin_uid
= 'db_store'¶
-
view_entries_icon_class
= 'glyphicon glyphicon-list'¶
-
view_saved_form_data_entries_template_name
= 'db_store/view_saved_form_data_entries.html'¶
-
-
class
fobi.contrib.plugins.form_handlers.http_repost.fobi_form_handlers.
HTTPRepostHandlerPlugin
(user=None)[source]¶ Bases:
fobi.base.FormHandlerPlugin
HTTP repost handler plugin.
Makes a HTTP repost to a given endpoint. Should be executed before
db_store
plugin.-
form
¶ alias of
HTTPRepostForm
-
name
= <django.utils.functional.__proxy__ object>¶
-
run
(form_entry, request, form, form_element_entries=None)[source]¶ Run.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_element_entries (iterable) – Iterable of
fobi.models.FormElementEntry
objects.
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'http_repost'¶
-
-
class
fobi.contrib.plugins.form_handlers.http_repost.forms.
HTTPRepostForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BasePluginForm
Form for
HTTPRepostPlugin
.-
base_fields
= OrderedDict([('endpoint_url', <django.forms.fields.URLField object at 0x7f383a214310>)])¶
-
declared_fields
= OrderedDict([('endpoint_url', <django.forms.fields.URLField object at 0x7f383a214310>)])¶
-
media
¶
-
plugin_data_fields
= [('endpoint_url', '')]¶
-
-
fobi.contrib.plugins.form_handlers.mail.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from
fobi.contrib.plugins.form_handlers.mail
conf module, falling back to the default.If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
-
class
fobi.contrib.plugins.form_handlers.mail.fields.
MultiEmailField
(required=True, widget=None, label=None, initial=None, help_text=u'', error_messages=None, show_hidden_initial=False, validators=[], localize=False, disabled=False, label_suffix=None)[source]¶ Bases:
django.forms.fields.Field
MultiEmailField.
-
code
= 'invalid'¶
-
message
= <django.utils.functional.__proxy__ object>¶
-
widget
¶ alias of
MultiEmailWidget
-
-
class
fobi.contrib.plugins.form_handlers.mail.fobi_form_handlers.
MailHandlerPlugin
(user=None)[source]¶ Bases:
fobi.base.FormHandlerPlugin
Mail handler plugin.
Sends emails to the person specified. Should be executed before
db_store
andhttp_repost
plugins.-
form
¶ alias of
MailForm
-
name
= <django.utils.functional.__proxy__ object>¶
-
run
(form_entry, request, form, form_element_entries=None)[source]¶ Run.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_element_entries (iterable) – Iterable of
fobi.models.FormElementEntry
objects.
- form_entry (fobi.models.FormEntry) – Instance of
-
uid
= 'mail'¶
-
-
class
fobi.contrib.plugins.form_handlers.mail.forms.
MailForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
,fobi.base.BasePluginForm
Form for
BooleanSelectPlugin
.-
base_fields
= OrderedDict([('from_name', <django.forms.fields.CharField object at 0x7f383a1ffe10>), ('from_email', <django.forms.fields.EmailField object at 0x7f383a1ffed0>), ('to_name', <django.forms.fields.CharField object at 0x7f383a1fff90>), ('to_email', <fobi.contrib.plugins.form_handlers.mail.fields.MultiEmailField object at 0x7f383a214090>), ('subject', <django.forms.fields.CharField object at 0x7f383a214150>), ('body', <django.forms.fields.CharField object at 0x7f383a214210>)])¶
-
declared_fields
= OrderedDict([('from_name', <django.forms.fields.CharField object at 0x7f383a1ffe10>), ('from_email', <django.forms.fields.EmailField object at 0x7f383a1ffed0>), ('to_name', <django.forms.fields.CharField object at 0x7f383a1fff90>), ('to_email', <fobi.contrib.plugins.form_handlers.mail.fields.MultiEmailField object at 0x7f383a214090>), ('subject', <django.forms.fields.CharField object at 0x7f383a214150>), ('body', <django.forms.fields.CharField object at 0x7f383a214210>)])¶
-
media
¶
-
plugin_data_fields
= [('from_name', ''), ('from_email', ''), ('to_name', ''), ('to_email', ''), ('subject', ''), ('body', '')]¶
-
-
fobi.contrib.plugins.form_handlers.mail.helpers.
send_mail
(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None, connection=None, html_message=None, attachments=None)[source]¶ Send email.
Easy wrapper for sending a single message to a recipient list. All members of the recipient list will see the other recipients in the ‘To’ field.
If auth_user is None, the EMAIL_HOST_USER setting is used. If auth_password is None, the EMAIL_HOST_PASSWORD setting is used.
Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.
-
class
fobi.contrib.plugins.form_importers.mailchimp_importer.fobi_form_importers.
MailChimpImporter
(form_entry_cls, form_element_entry_cls, form_properties=None, form_data=None)[source]¶ Bases:
fobi.form_importers.BaseFormImporter
MailChimp data importer.
-
extract_field_properties
(field_data)[source]¶ Extract field properties.
Handle choices differently as we know what the mailchimp format is.
-
field_properties_mapping
= {'initial': 'default', 'name': 'tag', 'required': 'req', 'choices': 'choices', 'help_text': 'helptext', 'label': 'name'}¶
-
field_type_prop_name
= 'field_type'¶
-
fields_mapping
= {'url': 'url', 'radio': 'radio', 'zip': 'text', 'dropdown': 'select', 'date': 'date', 'text': 'text', 'address': 'text', 'email': 'email', 'phone': 'text', 'number': 'integer'}¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
position_prop_name
= 'order'¶
-
templates
= ['mailchimp_importer/0.html', 'mailchimp_importer/1.html']¶
-
uid
= 'mailchimp'¶
-
wizard
¶ alias of
MailchimpImporterWizardView
-
-
class
fobi.contrib.plugins.form_importers.mailchimp_importer.forms.
MailchimpAPIKeyForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
MailchimpAPIKeyForm.
First form the the wizard. Here users are supposed to provide the API key of their Mailchimp account.
-
base_fields
= OrderedDict([('api_key', <django.forms.fields.CharField object at 0x7f383a1e2850>)])¶
-
declared_fields
= OrderedDict([('api_key', <django.forms.fields.CharField object at 0x7f383a1e2850>)])¶
-
media
¶
-
-
class
fobi.contrib.plugins.form_importers.mailchimp_importer.forms.
MailchimpListIDForm
(*args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
MailchimpListIDForm.
Second form of the wizard. Here users are supposed to choose the form they want to import.
-
base_fields
= OrderedDict([('list_id', <django.forms.fields.ChoiceField object at 0x7f383a200d50>)])¶
-
declared_fields
= OrderedDict([('list_id', <django.forms.fields.ChoiceField object at 0x7f383a200d50>)])¶
-
media
¶
-
-
class
fobi.contrib.plugins.form_importers.mailchimp_importer.views.
MailchimpImporterWizardView
(**kwargs)[source]¶ Bases:
formtools.wizard.views.SessionWizardView
MailchimpImporterWizardView.
-
form_list
= [<class 'fobi.contrib.plugins.form_importers.mailchimp_importer.forms.MailchimpAPIKeyForm'>, <class 'fobi.contrib.plugins.form_importers.mailchimp_importer.forms.MailchimpListIDForm'>]¶
-
-
class
fobi.contrib.themes.bootstrap3.widgets.form_elements.date_bootstrap3_widget.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_bootstrap3_widgets_form_elements_date_bootstrap3_widget'¶
-
name
= 'fobi.contrib.themes.bootstrap3.widgets.form_elements.date_bootstrap3_widget'¶
-
-
class
fobi.contrib.themes.bootstrap3.widgets.form_elements.date_bootstrap3_widget.fobi_form_elements.
DatePluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_elements.fields.date.widgets.BaseDatePluginWidget
Date plugin widget for Bootstrap 3.
-
media_css
= ['bootstrap3/css/bootstrap-datetimepicker.min.css']¶
-
media_js
= ['js/moment-with-locales.js', 'bootstrap3/js/bootstrap-datetimepicker.min.js', 'bootstrap3/js/fobi.plugin.date-bootstrap3-widget.js']¶
-
theme_uid
= 'bootstrap3'¶
-
-
class
fobi.contrib.themes.bootstrap3.widgets.form_elements.datetime_bootstrap3_widget.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_bootstrap3_widgets_form_elements_datetime_bootstrap3_widget'¶
-
name
= 'fobi.contrib.themes.bootstrap3.widgets.form_elements.datetime_bootstrap3_widget'¶
-
-
class
fobi.contrib.themes.bootstrap3.widgets.form_elements.datetime_bootstrap3_widget.fobi_form_elements.
DateTimePluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_elements.fields.datetime.widgets.BaseDateTimePluginWidget
DateTime plugin widget for Bootstrap 3.
-
media_css
= ['bootstrap3/css/bootstrap-datetimepicker.min.css']¶
-
media_js
= ['js/moment-with-locales.js', 'bootstrap3/js/bootstrap-datetimepicker.min.js', 'bootstrap3/js/fobi.plugin.datetime-bootstrap3-widget.js']¶
-
theme_uid
= 'bootstrap3'¶
-
-
class
fobi.contrib.themes.bootstrap3.widgets.form_elements.dummy_bootstrap3_widget.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_bootstrap3_widgets_form_elements_dummy_bootstrap3_widget'¶
-
name
= 'fobi.contrib.themes.bootstrap3.widgets.form_elements.dummy_bootstrap3_widget'¶
-
-
class
fobi.contrib.themes.bootstrap3.widgets.form_elements.dummy_bootstrap3_widget.fobi_form_elements.
DummyPluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_elements.test.dummy.widgets.BaseDummyPluginWidget
Dummy plugin widget for Boootstrap 3.
-
media_css
= []¶
-
media_js
= []¶
-
theme_uid
= 'bootstrap3'¶
-
-
class
fobi.contrib.themes.bootstrap3.fobi_themes.
Bootstrap3Theme
(user=None)[source]¶ Bases:
fobi.base.BaseTheme
Bootstrap3 theme.
-
add_form_element_entry_ajax_template
= 'bootstrap3/add_form_element_entry_ajax.html'¶
-
add_form_element_entry_template
= 'bootstrap3/add_form_element_entry.html'¶
-
add_form_handler_entry_ajax_template
= 'bootstrap3/add_form_handler_entry_ajax.html'¶
-
add_form_handler_entry_template
= 'bootstrap3/add_form_handler_entry.html'¶
-
base_template
= 'bootstrap3/base.html'¶
-
create_form_entry_ajax_template
= 'bootstrap3/create_form_entry_ajax.html'¶
-
create_form_entry_template
= 'bootstrap3/create_form_entry.html'¶
-
dashboard_template
= 'bootstrap3/dashboard.html'¶
-
edit_form_element_entry_ajax_template
= 'bootstrap3/edit_form_element_entry_ajax.html'¶
-
edit_form_element_entry_template
= 'bootstrap3/edit_form_element_entry.html'¶
-
edit_form_entry_ajax_template
= 'bootstrap3/edit_form_entry_ajax.html'¶
-
edit_form_entry_template
= 'bootstrap3/edit_form_entry.html'¶
-
edit_form_handler_entry_ajax_template
= 'bootstrap3/edit_form_handler_entry_ajax.html'¶
-
edit_form_handler_entry_template
= 'bootstrap3/edit_form_handler_entry.html'¶
-
embed_form_entry_submitted_ajax_template
= 'bootstrap3/embed_form_entry_submitted_ajax.html'¶
-
form_ajax
= 'bootstrap3/snippets/form_ajax.html'¶
-
form_delete_form_entry_option_class
= 'glyphicon glyphicon-remove'¶
-
form_edit_form_entry_option_class
= 'glyphicon glyphicon-edit'¶
-
form_element_checkbox_html_class
= 'checkbox'¶
-
form_element_html_class
= 'form-control'¶
-
form_entry_submitted_ajax_template
= 'bootstrap3/form_entry_submitted_ajax.html'¶
-
form_entry_submitted_template
= 'bootstrap3/form_entry_submitted.html'¶
-
form_importer_ajax_template
= 'bootstrap3/form_importer_ajax.html'¶
-
form_importer_template
= 'bootstrap3/form_importer.html'¶
-
form_list_container_class
= 'list-inline'¶
-
form_properties_snippet_template_name
= 'bootstrap3/snippets/form_properties_snippet.html'¶
-
form_snippet_template_name
= 'bootstrap3/snippets/form_snippet.html'¶
-
form_wizard_template
= 'bootstrap3/snippets/form_wizard.html'¶
-
forms_list_template
= 'bootstrap3/forms_list.html'¶
-
master_base_template
= 'bootstrap3/_base.html'¶
-
media_css
= ('bootstrap3/css/bootstrap.css', 'bootstrap3/css/bootstrap3_fobi_extras.css', 'css/fobi.core.css')¶
-
media_js
= ('js/jquery-1.10.2.min.js', 'jquery-ui/js/jquery-ui-1.10.4.custom.min.js', 'bootstrap3/js/bootstrap.min.js', 'js/jquery.slugify.js', 'js/fobi.core.js', 'bootstrap3/js/bootstrap3_fobi_extras.js')¶
-
messages_snippet_template_name
= 'bootstrap3/snippets/messages_snippet.html'¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'bootstrap3'¶
-
view_embed_form_entry_ajax_template
= 'bootstrap3/view_embed_form_entry_ajax.html'¶
-
view_form_entry_ajax_template
= 'bootstrap3/view_form_entry_ajax.html'¶
-
view_form_entry_template
= 'bootstrap3/view_form_entry.html'¶
-
-
class
fobi.contrib.themes.djangocms_admin_style_theme.widgets.form_handlers.db_store.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_djangocms_admin_style_theme_widgets_form_handlers_db_store'¶
-
name
= 'fobi.contrib.themes.djangocms_admin_style_theme.widgets.form_handlers.db_store'¶
-
-
class
fobi.contrib.themes.djangocms_admin_style_theme.widgets.form_handlers.db_store.fobi_form_elements.
DbStorePluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_handlers.db_store.widgets.BaseDbStorePluginWidget
DbStore plugin widget for djangocms_admin_style_theme theme.
-
export_entries_icon_class
= ''¶
-
theme_uid
= 'djangocms_admin_style_theme'¶
-
view_entries_icon_class
= ''¶
-
-
class
fobi.contrib.themes.djangocms_admin_style_theme.fobi_themes.
DjangoCMSAdminStyleTheme
(user=None)[source]¶ Bases:
fobi.base.BaseTheme
A theme that has a native
djangocms-admin-style
style.-
add_form_element_entry_ajax_template
= 'djangocms_admin_style_theme/add_form_element_entry_ajax.html'¶
-
add_form_element_entry_template
= 'djangocms_admin_style_theme/add_form_element_entry.html'¶
-
add_form_handler_entry_ajax_template
= 'djangocms_admin_style_theme/add_form_handler_entry_ajax.html'¶
-
add_form_handler_entry_template
= 'djangocms_admin_style_theme/add_form_handler_entry.html'¶
-
base_edit_template
= 'djangocms_admin_style_theme/base_edit.html'¶
-
base_template
= 'djangocms_admin_style_theme/base.html'¶
-
base_view_template
= 'djangocms_admin_style_theme/base_view.html'¶
-
create_form_entry_ajax_template
= 'djangocms_admin_style_theme/create_form_entry_ajax.html'¶
-
create_form_entry_template
= 'djangocms_admin_style_theme/create_form_entry.html'¶
-
dashboard_template
= 'djangocms_admin_style_theme/dashboard.html'¶
-
edit_form_element_entry_ajax_template
= 'djangocms_admin_style_theme/edit_form_element_entry_ajax.html'¶
-
edit_form_element_entry_template
= 'djangocms_admin_style_theme/edit_form_element_entry.html'¶
-
edit_form_entry_ajax_template
= 'djangocms_admin_style_theme/edit_form_entry_ajax.html'¶
-
classmethod
edit_form_entry_edit_option_html
()[source]¶ For adding the edit link to edit form entry view.
Return str:
-
classmethod
edit_form_entry_help_text_extra
()[source]¶ For adding the edit link to edit form entry view.
Return str:
-
edit_form_entry_template
= 'djangocms_admin_style_theme/edit_form_entry.html'¶
-
edit_form_handler_entry_ajax_template
= 'djangocms_admin_style_theme/edit_form_handler_entry_ajax.html'¶
-
edit_form_handler_entry_template
= 'djangocms_admin_style_theme/edit_form_handler_entry.html'¶
-
form_ajax
= 'djangocms_admin_style_theme/snippets/form_ajax.html'¶
-
form_delete_form_entry_option_class
= 'deletelink'¶
-
form_edit_ajax
= 'djangocms_admin_style_theme/snippets/form_edit_ajax.html'¶
-
form_edit_form_entry_option_class
= 'edit'¶
-
form_edit_snippet_template_name
= 'djangocms_admin_style_theme/snippets/form_edit_snippet.html'¶
-
form_element_checkbox_html_class
= 'checkbox'¶
-
form_element_html_class
= 'vTextField'¶
-
form_entry_submitted_ajax_template
= 'djangocms_admin_style_theme/form_entry_submitted_ajax.html'¶
-
form_entry_submitted_template
= 'djangocms_admin_style_theme/form_entry_submitted.html'¶
-
form_list_container_class
= 'list-inline'¶
-
form_properties_snippet_template_name
= 'djangocms_admin_style_theme/snippets/form_properties_snippet.html'¶
-
form_radio_element_html_class
= 'radiolist'¶
-
form_snippet_template_name
= 'djangocms_admin_style_theme/snippets/form_snippet.html'¶
-
form_view_snippet_template_name
= 'djangocms_admin_style_theme/snippets/form_view_snippet.html'¶
-
forms_list_template
= 'djangocms_admin_style_theme/forms_list.html'¶
-
import_form_entry_ajax_template
= 'djangocms_admin_style_theme/import_form_entry_ajax.html'¶
-
import_form_entry_template
= 'djangocms_admin_style_theme/import_form_entry.html'¶
-
master_base_template
= 'djangocms_admin_style_theme/_base.html'¶
-
media_css
= ('djangocms_admin_style_theme/css/fobi.djangocms_admin_style_theme.css', 'jquery-ui/css/smoothness/jquery-ui-1.10.3.custom.min.css')¶
-
media_js
= ('js/jquery-1.10.2.min.js', 'jquery-ui/js/jquery-ui-1.10.4.custom.min.js', 'js/jquery.slugify.js', 'js/fobi.core.js')¶
-
messages_snippet_template_name
= 'djangocms_admin_style_theme/snippets/messages_snippet.html'¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'djangocms_admin_style_theme'¶
-
view_form_entry_ajax_template
= 'djangocms_admin_style_theme/view_form_entry_ajax.html'¶
-
view_form_entry_template
= 'djangocms_admin_style_theme/view_form_entry.html'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_elements.date_foundation5_widget.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_foundation5_widgets_form_elements_date_foundation5_widget'¶
-
name
= 'fobi.contrib.themes.foundation5.widgets.form_elements.date_foundation5_widget'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_elements.date_foundation5_widget.fobi_form_elements.
DatePluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_elements.fields.date.widgets.BaseDatePluginWidget
Date plugin widget for Foundation 5.
-
media_css
= ['foundation5/css/foundation-datepicker.css']¶
-
media_js
= ['js/moment-with-locales.js', 'foundation5/js/foundation-datepicker.js', 'foundation5/js/fobi.plugin.date-foundation5-widget.js']¶
-
theme_uid
= 'foundation5'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_elements.datetime_foundation5_widget.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_foundation5_widgets_form_elements_datetime_foundation5_widget'¶
-
name
= 'fobi.contrib.themes.foundation5.widgets.form_elements.datetime_foundation5_widget'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_elements.datetime_foundation5_widget.fobi_form_elements.
DateTimePluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_elements.fields.datetime.widgets.BaseDateTimePluginWidget
DateTime plugin widget for Foundation 5.
-
media_css
= ['foundation5/css/foundation-datetimepicker.css']¶
-
media_js
= ['js/moment-with-locales.js', 'foundation5/js/foundation-datetimepicker.js', 'foundation5/js/fobi.plugin.datetime-foundation5-widget.js']¶
-
theme_uid
= 'foundation5'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_elements.dummy_foundation5_widget.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_foundation5_widgets_form_elements_dummy_foundation5_widget'¶
-
name
= 'fobi.contrib.themes.foundation5.widgets.form_elements.dummy_foundation5_widget'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_elements.dummy_foundation5_widget.fobi_form_elements.
DummyPluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_elements.test.dummy.widgets.BaseDummyPluginWidget
Dummy plugin widget for Foundation 5.
-
media_css
= []¶
-
media_js
= []¶
-
theme_uid
= 'foundation5'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_handlers.db_store_foundation5_widget.apps.
Config
(app_name, app_module)[source]¶ Bases:
django.apps.config.AppConfig
Config.
-
label
= 'fobi_contrib_themes_foundation5_widgets_form_handlers_db_store_foundation5_widget'¶
-
name
= 'fobi.contrib.themes.foundation5.widgets.form_handlers.db_store_foundation5_widget'¶
-
-
class
fobi.contrib.themes.foundation5.widgets.form_handlers.db_store_foundation5_widget.fobi_form_elements.
DbStorePluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_handlers.db_store.widgets.BaseDbStorePluginWidget
DbStore plugin widget for Foundation 5.
-
export_entries_icon_class
= 'fi-page-export'¶
-
theme_uid
= 'foundation5'¶
-
view_entries_icon_class
= 'fi-list'¶
-
view_saved_form_data_entries_template_name
= 'db_store_foundation5_widget/view_saved_form_data_entries.html'¶
-
-
class
fobi.contrib.themes.foundation5.fobi_themes.
Foundation5Theme
(user=None)[source]¶ Bases:
fobi.base.BaseTheme
Foundation5 theme.
Based on the “Workspace” example of the Foundation 5. Click here for more.
-
add_form_element_entry_ajax_template
= 'foundation5/add_form_element_entry_ajax.html'¶
-
add_form_element_entry_template
= 'foundation5/add_form_element_entry.html'¶
-
add_form_handler_entry_ajax_template
= 'foundation5/add_form_handler_entry_ajax.html'¶
-
add_form_handler_entry_template
= 'foundation5/add_form_handler_entry.html'¶
-
base_template
= 'foundation5/base.html'¶
-
create_form_entry_ajax_template
= 'foundation5/create_form_entry_ajax.html'¶
-
create_form_entry_template
= 'foundation5/create_form_entry.html'¶
-
dashboard_template
= 'foundation5/dashboard.html'¶
-
edit_form_element_entry_ajax_template
= 'foundation5/edit_form_element_entry_ajax.html'¶
-
edit_form_element_entry_template
= 'foundation5/edit_form_element_entry.html'¶
-
edit_form_entry_ajax_template
= 'foundation5/edit_form_entry_ajax.html'¶
-
edit_form_entry_template
= 'foundation5/edit_form_entry.html'¶
-
edit_form_handler_entry_ajax_template
= 'foundation5/edit_form_handler_entry_ajax.html'¶
-
edit_form_handler_entry_template
= 'foundation5/edit_form_handler_entry.html'¶
-
form_ajax
= 'foundation5/snippets/form_ajax.html'¶
-
form_delete_form_entry_option_class
= 'fi-page-delete'¶
-
form_edit_form_entry_option_class
= 'fi-page-edit'¶
-
form_element_checkbox_html_class
= 'checkbox'¶
-
form_element_html_class
= 'form-control'¶
-
form_entry_submitted_ajax_template
= 'foundation5/form_entry_submitted_ajax.html'¶
-
form_entry_submitted_template
= 'foundation5/form_entry_submitted.html'¶
-
form_list_container_class
= 'inline-list'¶
-
form_properties_snippet_template_name
= 'foundation5/snippets/form_properties_snippet.html'¶
-
form_snippet_template_name
= 'foundation5/snippets/form_snippet.html'¶
-
forms_list_template
= 'foundation5/forms_list.html'¶
-
import_form_entry_ajax_template
= 'foundation5/import_form_entry_ajax.html'¶
-
import_form_entry_template
= 'foundation5/import_form_entry.html'¶
-
master_base_template
= 'foundation5/_base.html'¶
-
media_css
= ('foundation5/css/foundation.min.css', 'foundation5/css/foundation_fobi_extras.css', 'foundation5/icons/3/icons/foundation-icons.css')¶
-
media_js
= ('foundation5/js/vendor/modernizr.js', 'foundation5/js/vendor/jquery.js', 'jquery-ui/js/jquery-ui-1.10.4.custom.min.js', 'foundation5/js/foundation.min.js', 'js/fobi.core.js', 'js/jquery.slugify.js', 'foundation5/js/foundation5_fobi_extras.js')¶
-
messages_snippet_template_name
= 'foundation5/snippets/messages_snippet.html'¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'foundation5'¶
-
view_form_entry_ajax_template
= 'foundation5/view_form_entry_ajax.html'¶
-
view_form_entry_template
= 'foundation5/view_form_entry.html'¶
-
-
class
fobi.contrib.themes.simple.widgets.form_handlers.db_store.fobi_form_elements.
DbStorePluginWidget
(plugin)[source]¶ Bases:
fobi.contrib.plugins.form_handlers.db_store.widgets.BaseDbStorePluginWidget
DbStore plugin widget for Simple theme.
-
export_entries_icon_class
= ''¶
-
theme_uid
= 'simple'¶
-
view_entries_icon_class
= ''¶
-
-
class
fobi.contrib.themes.simple.fobi_themes.
SimpleTheme
(user=None)[source]¶ Bases:
fobi.base.BaseTheme
Simple theme that has a native Django style.
-
add_form_element_entry_ajax_template
= 'simple/add_form_element_entry_ajax.html'¶
-
add_form_element_entry_template
= 'simple/add_form_element_entry.html'¶
-
add_form_handler_entry_ajax_template
= 'simple/add_form_handler_entry_ajax.html'¶
-
add_form_handler_entry_template
= 'simple/add_form_handler_entry.html'¶
-
base_edit_template
= 'simple/base_edit.html'¶
-
base_template
= 'simple/base.html'¶
-
base_view_template
= 'simple/base_view.html'¶
-
create_form_entry_ajax_template
= 'simple/create_form_entry_ajax.html'¶
-
create_form_entry_template
= 'simple/create_form_entry.html'¶
-
dashboard_template
= 'simple/dashboard.html'¶
-
edit_form_element_entry_ajax_template
= 'simple/edit_form_element_entry_ajax.html'¶
-
edit_form_element_entry_template
= 'simple/edit_form_element_entry.html'¶
-
edit_form_entry_ajax_template
= 'simple/edit_form_entry_ajax.html'¶
-
edit_form_entry_template
= 'simple/edit_form_entry.html'¶
-
edit_form_handler_entry_ajax_template
= 'simple/edit_form_handler_entry_ajax.html'¶
-
edit_form_handler_entry_template
= 'simple/edit_form_handler_entry.html'¶
-
form_ajax
= 'simple/snippets/form_ajax.html'¶
-
form_delete_form_entry_option_class
= 'glyphicon glyphicon-remove'¶
-
form_edit_ajax
= 'simple/snippets/form_edit_ajax.html'¶
-
form_edit_form_entry_option_class
= 'glyphicon glyphicon-edit'¶
-
form_edit_snippet_template_name
= 'simple/snippets/form_edit_snippet.html'¶
-
form_element_checkbox_html_class
= 'checkbox'¶
-
form_element_html_class
= 'vTextField'¶
-
form_entry_submitted_ajax_template
= 'simple/form_entry_submitted_ajax.html'¶
-
form_entry_submitted_template
= 'simple/form_entry_submitted.html'¶
-
form_list_container_class
= 'list-inline'¶
-
form_properties_snippet_template_name
= 'simple/snippets/form_properties_snippet.html'¶
-
form_radio_element_html_class
= 'radiolist'¶
-
form_snippet_template_name
= 'simple/snippets/form_snippet.html'¶
-
form_view_snippet_template_name
= 'simple/snippets/form_view_snippet.html'¶
-
forms_list_template
= 'simple/forms_list.html'¶
-
import_form_entry_ajax_template
= 'simple/import_form_entry_ajax.html'¶
-
import_form_entry_template
= 'simple/import_form_entry.html'¶
-
master_base_template
= 'simple/_base.html'¶
-
media_css
= ('simple/css/fobi.simple.css', 'jquery-ui/css/django-admin-theme/jquery-ui-1.10.4.custom.min.css')¶
-
media_js
= ('js/jquery-1.10.2.min.js', 'jquery-ui/js/jquery-ui-1.10.4.custom.min.js', 'js/jquery.slugify.js', 'js/fobi.core.js')¶
-
messages_snippet_template_name
= 'simple/snippets/messages_snippet.html'¶
-
name
= <django.utils.functional.__proxy__ object>¶
-
uid
= 'simple'¶
-
view_form_entry_ajax_template
= 'simple/view_form_entry_ajax.html'¶
-
view_form_entry_template
= 'simple/view_form_entry.html'¶
-
Module contents¶
fobi.integration package¶
Submodules¶
fobi.integration.helpers module¶
-
fobi.integration.helpers.
get_template_choices
(source, choices, theme_specific_choices_key)[source]¶ Get the template choices.
It’s possible to provide theme templates per theme or just per project.
Parameters: - source (str) – Example value ‘feincms_integration’.
- or list choices (tuple) –
- theme_specific_choices_key (str) –
Return list:
fobi.integration.processors module¶
-
class
fobi.integration.processors.
IntegrationProcessor
[source]¶ Bases:
object
Generic integration processor.
Parameters: - form_sent_get_param (str) –
- can_redirect (bool) – If set to True, if not authenticated
an attempt to redirect user to a login page would be made. Otherwise,
a message about authentication would be generated instead (in place
of the form). Some content management systems, like Django-CMS, aren’t
able to redirect on plugin level. For those systems, the value
of
can_redirect
should be set to False. - login_required_template_name (str) – Template to be used for
rendering the login required message. This is only important when
login_required_redirect
is set to False.
-
can_redirect
= True¶
-
form_sent_get_param
= 'sent'¶
-
integration_check
(instance)[source]¶ Integration check.
Performs a simple check to identify whether the model instance has been implemented according to the expectations.
-
login_required_template_name
= None¶
Module contents¶
fobi.management package¶
Subpackages¶
-
class
fobi.management.commands.fobi_migrate_03_to_04.
Command
(stdout=None, stderr=None, no_color=False)[source]¶ Bases:
django.core.management.base.BaseCommand
Database related changes necessary to upgrade fobi==0.3.* to fobi==0.4.
The full list of changes is listed below:
- Change the “birthday” occurrences to “date_drop_down”.
-
class
fobi.management.commands.fobi_sync_plugins.
Command
(stdout=None, stderr=None, no_color=False)[source]¶ Bases:
django.core.management.base.BaseCommand
Adds the missing plugins to database.
This command shall be ran every time a developer adds a new plugin. The following plugins are affected:
fobi.models.FormElementPlugin
fobi.models.FormHandlerPlugin
-
class
fobi.management.commands.fobi_update_plugin_data.
Command
(stdout=None, stderr=None, no_color=False)[source]¶ Bases:
django.core.management.base.BaseCommand
Updates the plugin data for all entries of all users.
Rules for update are specified in the plugin itself.
This command shall be ran if significant changes have been made to the system for which the data shall be updated.
Module contents¶
fobi.templatetags package¶
Submodules¶
fobi.templatetags.fobi_tags module¶
Get the plugin.
Note, that
entry
shall be a instance offobi.models.FormElementEntry
orfobi.models.FormHandlerEntry
.Syntax: {% get_fobi_plugin entry as [context_var_name] %}
Example: {% get_fobi_plugin entry as plugin %}
{% get_fobi_plugin entry as plugin %} {{ plugin.render }}
Get the form handler plugin custom actions.
Note, that
plugin
shall be a instance offobi.models.FormHandlerEntry
.Syntax: - {% get_fobi_form_handler_plugin_custom_actions
[plugin] [form_entry] as [context_var_name] %}
Example: - {% get_fobi_form_handler_plugin_custom_actions
plugin form_entry as form_handler_plugin_custom_actions %}
Get form field type.
Syntax:
{% get_form_field_type [field] as [context_var_name] %}
Example:
{% get_form_field_type form.field as form_field_type %} {% if form_field_type.is_checkbox %} ... {% endif %}
Get form hidden fields errors.
Syntax: {% get_form_hidden_fields_errors [form] as [context_var_name] %} Example: {% get_form_hidden_fields_errors form as form_hidden_fields_errors %} {{ form_hidden_fields_errors.as_ul }}
Checks the permissions
Syntax: {% has_edit_form_entry_permissions as [var_name] %}
Example: {% has_edit_form_entry_permissions %}
or
{% has_edit_form_entry_permissions as has_permissions %}
Render auth link.
Render the list of fobi forms.
Syntax: {% render_fobi_forms_list [queryset] [show_edit_link] [show_delete_link] [show_export_link] %} Example: {% render_fobi_forms_list queryset show_edit_link=True show_delete_link=False show_export_link=False %}
fobi.templatetags.future_compat module¶
Outputs the first variable passed that is not False.
Outputs the first variable passed that is not False, without escaping.
Outputs nothing if all the passed variables are False.
Sample usage:
{% firstof var1 var2 var3 %}
This is equivalent to:
{% if var1 %} {{ var1|safe }} {% elif var2 %} {{ var2|safe }} {% elif var3 %} {{ var3|safe }} {% endif %}
but obviously much cleaner!
You can also use a literal string as a fallback value in case all passed variables are False:
{% firstof var1 var2 var3 "fallback value" %}
If you want to escape the output, use a filter tag:
{% filter force_escape %} {% firstof var1 var2 var3 "fallback value" %} {% endfilter %}
Module contents¶
fobi.tests package¶
Submodules¶
fobi.tests.base module¶
fobi.tests.constants module¶
fobi.tests.data module¶
fobi.tests.helpers module¶
-
fobi.tests.helpers.
get_or_create_admin_user
()[source]¶ Create a user for testing the fobi.
TODO: At the moment an admin account is being tested. Automated tests with diverse accounts are to be implemented.
-
fobi.tests.helpers.
get_or_create_admin_user
()[source] Create a user for testing the fobi.
TODO: At the moment an admin account is being tested. Automated tests with diverse accounts are to be implemented.
-
fobi.tests.helpers.
create_form_with_entries
(user=None, create_entries_if_form_exist=True)[source]¶ Create test form with entries. Fills the form with pre-defined plugins.
Parameters: - user (django.contrib.auth.models.User) –
- create_entries_if_form_exist (bool) – If set to True, entries are being created even if form already exists (a database record).
Return fobi.models.FormEntry: Instance of
fobi.models.FormEntry
with a number of form elements and handlers filled in.
fobi.tests.test_browser_build_dynamic_forms module¶
-
class
fobi.tests.test_browser_build_dynamic_forms.
FobiBrowserBuldDynamicFormsTest
(methodName='runTest')[source]¶ Bases:
django.test.testcases.LiveServerTestCase
Browser tests django-fobi bulding forms functionality.
Backed up by selenium. This test is based on the bootstrap3 theme.
-
LIVE_SERVER_URL
= None¶
-
cleans_up_after_itself
= True¶
-
e
= AttributeError("'Settings' object has no attribute 'LIVE_SERVER_URL'",)¶
-
test_1001_open_dashboard
(*args, **kwargs)¶
-
test_2001_add_form
(*args, **kwargs)¶
-
test_2002_edit_form
(*args, **kwargs)¶
-
test_2003_delete_form
(*args, **kwargs)¶
-
test_2004_submit_form
(*args, **kwargs)¶
-
test_3001_add_form_elements
(*args, **kwargs)¶
-
test_3002_remove_form_elements
(*args, **kwargs)¶
-
test_3003_edit_form_elements
(*args, **kwargs)¶
-
test_4001_add_form_handlers
(*args, **kwargs)¶
-
test_4002_remove_form_handlers
(*args, **kwargs)¶
-
test_4003_edit_form_handlers
(*args, **kwargs)¶
-
fobi.tests.test_core module¶
-
class
fobi.tests.test_core.
FobiCoreTest
(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
Tests of django-fobi core functionality.
-
test_01_get_registered_form_element_plugins
(*args, **kwargs)¶
-
test_02_get_registered_form_handler_plugins
(*args, **kwargs)¶
-
test_03_get_registered_form_callbacks
(*args, **kwargs)¶
-
test_04_get_registered_themes
(*args, **kwargs)¶
-
test_05_action_url
(*args, **kwargs)¶
-
fobi.tests.test_dynamic_forms module¶
fobi.tests.test_form_importers_mailchimp module¶
fobi.tests.test_sortable_dict module¶
Module contents¶
Submodules¶
fobi.admin module¶
-
class
fobi.admin.
BasePluginModelAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
Base plugin admin.
-
BasePluginModelAdmin.
bulk_change_plugins
(*args, **kwargs)[source]¶ Bulk change plugins.
This is where the data is actually processed.
-
BasePluginModelAdmin.
fieldsets
= ((None, {'fields': ('plugin_uid', 'users', 'groups')}),)¶
-
BasePluginModelAdmin.
filter_horizontal
= ('users', 'groups')¶
-
BasePluginModelAdmin.
get_queryset
(request)¶ Internal method used in get_queryset or queryset methods.
-
BasePluginModelAdmin.
has_add_permission
(request)[source]¶ Has add permissions.
We don’t want to allow to add form elements/handlers manually. It should happen using the management command
fobi_sync_plugins
instead.
-
BasePluginModelAdmin.
list_display
= ('plugin_uid_admin', 'users_list', 'groups_list')¶
-
BasePluginModelAdmin.
media
¶
-
BasePluginModelAdmin.
readonly_fields
= ('plugin_uid', 'plugin_uid_admin')¶
-
-
class
fobi.admin.
FormElementAdmin
(model, admin_site)[source]¶ Bases:
fobi.admin.BasePluginModelAdmin
FormElement admin.
-
actions
= [<function bulk_change_form_element_plugins at 0x7f383a301050>]¶
-
media
¶
-
-
class
fobi.admin.
FormElementEntryAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
FormElementEntry admin.
-
FormElementEntryAdmin.
fieldsets
= ((<django.utils.functional.__proxy__ object at 0x7f383a13d590>, {'fields': ('plugin_uid', 'plugin_data')}), (<django.utils.functional.__proxy__ object at 0x7f383a13d610>, {'fields': ('form_entry', 'form_fieldset_entry', 'position')}))¶
-
FormElementEntryAdmin.
get_queryset
(request)¶ Internal method used in get_queryset or queryset methods.
-
FormElementEntryAdmin.
list_display
= ('plugin_uid', 'plugin_uid_code', 'plugin_data', 'position', 'form_entry')¶
-
FormElementEntryAdmin.
list_editable
= ('position',)¶
-
FormElementEntryAdmin.
list_filter
= ('form_entry', 'plugin_uid')¶
-
FormElementEntryAdmin.
media
¶
-
FormElementEntryAdmin.
readonly_fields
= ('plugin_uid_code',)¶
-
-
class
fobi.admin.
FormElementEntryInlineAdmin
(parent_model, admin_site)[source]¶ Bases:
django.contrib.admin.options.TabularInline
FormElementEntry inline admin.
-
extra
= 0¶
-
fields
= ('form_entry', 'plugin_uid', 'plugin_data', 'position')¶
-
form
¶ alias of
FormElementEntryForm
-
media
¶
-
model
¶ alias of
FormElementEntry
-
-
class
fobi.admin.
FormEntryAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
FormEntry admin.
-
FormEntryAdmin.
fieldsets
= ((<django.utils.functional.__proxy__ object at 0x7f383a3ac890>, {'fields': ('name', 'is_public', 'is_cloneable')}), (<django.utils.functional.__proxy__ object at 0x7f383a3ac410>, {'fields': ('success_page_title', 'success_page_message', 'action'), 'classes': ('collapse',)}), (<django.utils.functional.__proxy__ object at 0x7f383a3ac4d0>, {'fields': ('user',), 'classes': ('collapse',)}), (<django.utils.functional.__proxy__ object at 0x7f383a3ac510>, {'fields': ('slug',), 'classes': ('collapse',)}))¶
-
FormEntryAdmin.
inlines
= [<class 'fobi.admin.FormElementEntryInlineAdmin'>, <class 'fobi.admin.FormHandlerEntryInlineAdmin'>]¶
-
FormEntryAdmin.
list_display
= ('name', 'slug', 'user', 'is_public', 'created', 'updated', 'is_cloneable')¶
-
FormEntryAdmin.
list_editable
= ('is_public', 'is_cloneable')¶
-
FormEntryAdmin.
list_filter
= ('is_public', 'is_cloneable')¶
-
FormEntryAdmin.
media
¶
-
FormEntryAdmin.
radio_fields
= {'user': 2}¶
-
FormEntryAdmin.
readonly_fields
= ('slug',)¶
-
-
class
fobi.admin.
FormFieldsetEntryAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
FormEieldsetEntry admin.
-
FormFieldsetEntryAdmin.
fieldsets
= ((None, {'fields': ('form_entry', 'name', 'is_repeatable')}),)¶
-
FormFieldsetEntryAdmin.
list_display
= ('form_entry', 'name', 'is_repeatable')¶
-
FormFieldsetEntryAdmin.
list_editable
= ('is_repeatable',)¶
-
FormFieldsetEntryAdmin.
list_filter
= ('is_repeatable',)¶
-
FormFieldsetEntryAdmin.
media
¶
-
-
class
fobi.admin.
FormHandlerAdmin
(model, admin_site)[source]¶ Bases:
fobi.admin.BasePluginModelAdmin
FormHandler admin.
-
actions
= [<function bulk_change_form_handler_plugins at 0x7f383a3010c8>]¶
-
media
¶
-
-
class
fobi.admin.
FormHandlerEntryAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
FormHandlerEntry admin.
-
FormHandlerEntryAdmin.
fieldsets
= ((<django.utils.functional.__proxy__ object at 0x7f383a13d790>, {'fields': ('plugin_uid', 'plugin_data')}), (<django.utils.functional.__proxy__ object at 0x7f383a13d810>, {'fields': ('form_entry',)}))¶
-
FormHandlerEntryAdmin.
get_queryset
(request)¶ Internal method used in get_queryset or queryset methods.
-
FormHandlerEntryAdmin.
list_display
= ('plugin_uid', 'plugin_uid_code', 'plugin_data', 'form_entry')¶
-
FormHandlerEntryAdmin.
list_filter
= ('form_entry', 'plugin_uid')¶
-
FormHandlerEntryAdmin.
media
¶
-
FormHandlerEntryAdmin.
readonly_fields
= ('plugin_uid_code',)¶
-
-
class
fobi.admin.
FormHandlerEntryInlineAdmin
(parent_model, admin_site)[source]¶ Bases:
django.contrib.admin.options.TabularInline
FormHandlerEntry inline admin.
-
extra
= 0¶
-
fields
= ('form_entry', 'plugin_uid', 'plugin_data')¶
-
form
¶ alias of
FormHandlerEntryForm
-
media
¶
-
model
¶ alias of
FormHandlerEntry
-
-
fobi.admin.
base_bulk_change_plugins
(PluginForm, named_url, modeladmin, request, queryset)[source]¶ Bulk change of plugins action additional view.
fobi.app module¶
fobi.apps module¶
fobi.base module¶
-
class
fobi.base.
FormElementPluginDataStorage
[source]¶ Bases:
fobi.base.BaseDataStorage
Storage for FormField data.
-
class
fobi.base.
FormHandlerPluginDataStorage
[source]¶ Bases:
fobi.base.BaseDataStorage
Storage for FormField data.
-
class
fobi.base.
BasePluginForm
[source]¶ Bases:
object
Not a form actually; defined for magic only.
Property iterable plugin_data_fields: Fields to get when calling the
get_plugin_data
method. These field will be JSON serialized. All other fields, even if they are part of the form, won’t be. Make sure all fields are serializable. If some of them aren’t, override thesave_plugin_data
method and make them serializable there. See fobi.contrib.plugins.form_elements.fields.select.forms as a good example.Example: >>> plugin_data_fields = ( >>> ('name', ''), >>> ('active': False) >>> )
-
get_plugin_data
(request=None, json_format=True)[source]¶ Get plugin data.
Data that would be saved in the
plugin_data
field of thefobi.models.FormElementEntry
or ``fobi.models.FormHandlerEntry`.` subclassed model.Parameters: request (django.http.HttpRequest) –
-
plugin_data_fields
= None¶
-
-
class
fobi.base.
BasePlugin
(user=None)[source]¶ Bases:
object
Base plugin.
Base form field from which every form field should inherit.
Properties: - uid (string): Plugin uid (obligatory). Example value: ‘dummy’,
‘wysiwyg’, ‘news’.
- name (string): Plugin name (obligatory). Example value:
‘Dummy plugin’, ‘WYSIWYG’, ‘Latest news’.
- description (string): Plugin decription (optional). Example
value: ‘Dummy plugin used just for testing’.
- help_text (string): Plugin help text (optional). This text would
be shown in
fobi.views.add_form_plugin_entry
andfobi.views.edit_form_plugin_entry
views.
- form: Plugin form (optional). A subclass of
django.forms.Form
. Should be given in case plugin is configurable.
- form: Plugin form (optional). A subclass of
- add_form_template (str) (optional): Add form template (optional).
If given, overrides the
fobi.views.add_form_handler_entry default template.
- edit_form_template (string): Edit form template (optional). If
given, overrides the fobi.views.edit_form_handler_entry default template.
html_classes (list): List of extra HTML classes for the plugin.
- group (string): Plugin are grouped under the specified group.
Override in your plugin if necessary.
-
add_form_template
= None¶
-
clone_plugin_data
(entry)[source]¶ Clone plugin data.
Used when copying entries. If any objects or files are created by plugin, they should be cloned.
Parameters: fobi.models.AbstractPluginEntry – Instance of fobi.models.AbstractPluginEntry
.Return string: JSON dumped string of the cloned plugin data. The returned value would be inserted as is into the fobi.models.AbstractPluginEntry.plugin_data field.
-
delete_plugin_data
()[source]¶ Delete plugin data (internal method).
Used in
fobi.views.delete_form_entry
andfobi.views.delete_form_handler_entry
. Fired automatically, whenfobi.models.FormEntry
object is about to be deleted. Make use of it if your plugin creates database records or files that are not monitored externally but by dash only.
-
description
= None¶
-
edit_form_template
= None¶
-
form
= None¶
-
get_cloned_plugin_data
(update={})[source]¶ Get cloned plugin data.
Get the cloned plugin data and returns it in a JSON dumped format.
Parameters: update (dict) – Return string: JSON dumped string of the cloned plugin data. Example: - In the
get_cloned_plugin_data
method of your plugin, do as - follows:
>>> def clone_plugin_data(self, dashboard_entry): >>> cloned_image = clone_file(self.data.image, relative_path=True) >>> return self.get_cloned_plugin_data( >>> update={'image': cloned_image} >>> )
- In the
-
get_form
()[source]¶ Get the plugin form class.
Override this method in your subclassed
fobi.base.BasePlugin
class when you need your plugin setup to vary depending on the placeholder, workspace, user or request given. By default returns the value of theform
attribute defined in your plugin.Return django.forms.Form|django.forms.ModelForm: Subclass of django.forms.Form
ordjango.forms.ModelForm
.
-
get_initialised_create_form
(data=None, files=None, initial_data=None)[source]¶ Get initialized create form.
Used
fobi.views.add_form_element_entry
andfobi.views.add_form_handler_entry
view to gets initialised form for object to be created.
-
get_initialised_create_form_or_404
(data=None, files=None)[source]¶ Get initialized create form or page 404.
Same as
get_initialised_create_form
but raisesdjango.http.Http404
on errors.
-
get_initialised_edit_form
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None)[source]¶ Get initialized edit form.
Used in
fobi.views.edit_form_element_entry
andfobi.views.edit_form_handler_entry
views.
-
get_initialised_edit_form_or_404
(data=None, files=None, auto_id='id_%s', prefix=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=':', empty_permitted=False)[source]¶ Get initialized edit form or page 404.
Same as
get_initialised_edit_form
but raisesdjango.http.Http404
on errors.
-
get_plugin_form_data
()[source]¶ Get plugin form data.
Fed as
initial
argument to the plugin form when initialising the instance for adding or editing the plugin. Override in your plugin class if you need customisations.
-
get_updated_plugin_data
(update={})[source]¶ Get updated plugin data.
Returns it in a JSON dumped format.
Parameters: update (dict) – Return string: JSON dumped string of the cloned plugin data.
-
get_widget
(request=None, as_instance=False)[source]¶ Get the plugin widget.
Parameters: - request (django.http.HttpRequest) –
- as_instance (bool) –
Return mixed: Subclass of fobi.base.BasePluginWidget or instance of subclassed fobi.base.BasePluginWidget object.
-
group
= <django.utils.functional.__proxy__ object>¶
-
help_text
= None¶
-
html_class
¶ HTML class.
A massive work on positioning the plugin and having it to be displayed in a given width is done here. We should be getting the plugin widget for the plugin given and based on its’ properties (static!) as well as on plugin position (which we have from model), we can show the plugin with the exact class.
-
html_classes
= []¶
-
html_id
¶ HTML id.
-
load_plugin_data
(plugin_data)[source]¶ Load plugin data.
Load the plugin data saved in
fobi.models.FormElementEntry
orfobi.models.FormHandlerEntry
. Plugin data is saved in JSON string.Parameters: plugin_data (string) – JSON string with plugin data.
-
media_css
= []¶
-
media_js
= []¶
-
name
= None¶
-
plugin_data_repr
()[source]¶ Plugin data repr.
Human readable representation of plugin data. A very basic way would be just:
>>> return self.data.__dict__
Return string:
-
post_processor
()[source]¶ Post-processor (self).
Redefine in your subclassed plugin when necessary.
Post process plugin data here (before rendering). This method is being called after the data has been loaded into the plugin.
Note, that request (django.http.HttpRequest) is available (self.request).
-
pre_processor
()[source]¶ Pre-processor (callback).
Redefine in your subclassed plugin when necessary.
Pre process plugin data (before rendering). This method is being called before the data has been loaded into the plugin.
Note, that request (django.http.HttpRequest) is available ( self.request).
-
render
(request=None)[source]¶ Renders the plugin HTML.
Parameters: request (django.http.HttpRequest) – Return string:
-
storage
= None¶
-
uid
= None¶
-
update_plugin_data
(entry)[source]¶ Update plugin data.
Used in
fobi.management.commands.fobi_update_plugin_data
.Some plugins would contain data fetched from various sources (models, remote data). Since form entries are by definition loaded extremely much, you are advised to store as much data as possible in
plugin_data
field offobi.models.FormElementEntry
orfobi.models.FormHandlerEntry
. Some externally fetched data becomes invalid after some time and needs updating. For that purpose, in case if your plugin needs that, redefine this method in your plugin. If you need your data to be periodically updated, add a cron-job which would runfobi_update_plugin_data
management command (seefobi.management.commands.fobi_update_plugin_data
module).Parameters: or fobi.models.FormHandlerEntry (fobi.models.FormElementEntry) – Instance of fobi.models.FormeHandlerEntry
.Return dict: Should return a dictionary containing data of fields to be updated.
-
widget
= None¶
-
class
fobi.base.
FormElementPlugin
(user=None)[source]¶ Bases:
fobi.base.BasePlugin
Base form element plugin.
Property fobi.base.FormElementPluginDataStorage storage: Property bool has_value: If set to False, ignored (removed) from the POST when processing the form. -
get_form_field_instances
(request=None)[source]¶ Get the instances of form fields, that plugin contains.
Parameters: request (django.http.HttpRequest) – Return list: List of Django form field instances. Example: >>> from django.forms.fields import CharField, IntegerField, TextField >>> [CharField(max_length=100), IntegerField(), TextField()]
-
get_origin_kwargs_update_func_results
(kwargs_update_func, form_element_entry, origin, extra={}, widget_cls=None)[source]¶ Get origin kwargs update func results.
If
kwargs_update_func
is given, is callable and returns results without failures, return the result. Otherwise - return None.
-
get_origin_return_func_results
(return_func, form_element_entry, origin)[source]¶ Get origin return func results.
If
return_func
is given, is callable and returns results without failures, return the result. Otherwise - return None.
-
has_value
= False¶
-
storage
¶ alias of
FormElementPluginDataStorage
-
submit_plugin_form_data
(form_entry, request, form)[source]¶ Submit plugin form data.
Called on form submission (when user actually posts the data to assembled form).
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
-
class
fobi.base.
FormHandlerPlugin
(user=None)[source]¶ Bases:
fobi.base.BasePlugin
Form handler plugin.
Property fobi.base.FormHandlerPluginDataStorage storage: Property bool allow_multiple: If set to True, plugin can be used multiple times within (per form). Otherwise - just once. -
allow_multiple
= True¶
-
custom_actions
(form_entry, request=None)[source]¶ Custom actions.
Override this method in your form handler if you want to specify custom actions. Note, that expected return value of this method is an iterable with a triple, where the first item is the URL of the action and the second item is the action title and the third item is the icon class of the action.
Example: >>> return ( >>> ('/add-to-favorites/', >>> 'Add to favourites', >>> 'glyphicon glyphicon-favourties'), >>> )
-
get_custom_actions
(form_entry, request=None)[source]¶ Internal method to for obtaining the
get_custom_actions
.
-
run
(form_entry, request, form, form_element_entries=None)[source]¶ Run.
Custom code should be implemented here.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_element_entries (iterable) – Iterable of
fobi.models.FormElementEntry
objects.
Return mixed: May be a tuple (bool, mixed) or None
- form_entry (fobi.models.FormEntry) – Instance of
-
storage
¶ alias of
FormHandlerPluginDataStorage
-
-
class
fobi.base.
FormCallback
[source]¶ Bases:
object
Base form callback.
-
callback
(form_entry, request, form)[source]¶ Callback.
Custom callback code should be implemented here.
Parameters: - form_entry (fobi.models.FormEntry) – Instance of
fobi.models.FormEntry
. - request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_entry (fobi.models.FormEntry) – Instance of
-
stage
= None¶
-
-
class
fobi.base.
BaseRegistry
[source]¶ Bases:
object
Base registry.
Registry of plugins. It’s essential, that class registered has the
uid
property.If
fail_on_missing_plugin
is set to True, an appropriate exception (plugin_not_found_exception_cls
) is raised in cases if plugin cound’t be found in the registry.Property mixed type: Property bool fail_on_missing_plugin: Property fobi.exceptions.DoesNotExist plugin_not_found_exception_cls: Property str plugin_not_found_error_message: -
fail_on_missing_plugin
= False¶
-
get
(uid, default=None)[source]¶ Get the given entry from the registry.
Parameters: uid (string) – :return mixed.
-
plugin_not_found_error_message
= "Can't find plugin with uid `{0}` in `{1}` registry."¶
-
plugin_not_found_exception_cls
¶ alias of
DoesNotExist
-
type
= None¶
-
-
class
fobi.base.
FormElementPluginRegistry
[source]¶ Bases:
fobi.base.BaseRegistry
Form element plugins registry.
-
fail_on_missing_plugin
= True¶
-
plugin_not_found_exception_cls
¶ alias of
FormElementPluginDoesNotExist
-
type
= (<class 'fobi.base.FormElementPlugin'>, <class 'fobi.base.FormFieldPlugin'>)¶
-
-
class
fobi.base.
FormHandlerPluginRegistry
[source]¶ Bases:
fobi.base.BaseRegistry
Form handler plugins registry.
-
fail_on_missing_plugin
= True¶
-
plugin_not_found_exception_cls
¶ alias of
FormHandlerPluginDoesNotExist
-
type
¶ alias of
FormHandlerPlugin
-
-
class
fobi.base.
FormCallbackRegistry
[source]¶ Bases:
object
Registry of callbacks.
Holds callbacks for stages listed in the
fobi.constants.CALLBACK_STAGES
.
-
fobi.base.
classproperty
¶ alias of
ClassProperty
-
fobi.base.
get_registered_plugins
(registry, as_instances=False, sort_items=True)[source]¶ Get registered plugins.
Get a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet auto-discovered, auto-discovers them.
Parameters: - registry –
- as_instances (bool) –
- sort_items (bool) –
Return list:
-
fobi.base.
get_registered_plugin_uids
(registry, flattern=True, sort_items=True)[source]¶ Get a list of registered plugin uids as a list .
If not yet auto-discovered, auto-discovers them.
The sort_items is applied only if flattern is True.
Parameters: - registry –
- flattern (bool) –
- sort_items (bool) –
Return list:
-
fobi.base.
get_registered_form_element_plugins
()[source]¶ Get registered form element plugins.
Gets a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet autodiscovered, autodiscovers them.
Return list:
-
fobi.base.
get_registered_form_element_plugin_uids
(flattern=True)[source]¶ Get registered form element plugin uids.
Gets a list of registered plugins in a form if tuple (plugin name, plugin description). If not yet auto-discovered, auto-discovers them.
Return list:
-
fobi.base.
validate_form_element_plugin_uid
(plugin_uid)[source]¶ Validate the form element plugin uid.
Parameters: plugin_uid (string) – Return bool:
-
fobi.base.
get_registered_form_handler_plugins
(as_instances=False)[source]¶ Get registered form handler plugins.
Gets a list of registered plugins in a form of tuple (plugin name, plugin description). If not yet auto-discovered, auto-discovers them.
Return list:
-
fobi.base.
get_registered_form_handler_plugin_uids
(flattern=True)[source]¶ Get registered form handler plugin uids.
Gets a list of UIDs of registered form handler plugins. If not yet auto-discovered, auto-discovers them.
Return list:
-
fobi.base.
validate_form_handler_plugin_uid
(plugin_uid)[source]¶ Validate the plugin uid.
Parameters: plugin_uid (string) – Return bool:
-
fobi.base.
get_registered_form_callbacks
(stage=None)[source]¶ Get registered form callbacks for the stage given.
-
fobi.base.
fire_form_callbacks
(form_entry, request, form, stage=None)[source]¶ Fire form callbacks.
Parameters: - form_entry (fobi.models.FormEntry) –
- request (django.http.HttpRequest) –
- form (django.forms.Form) –
- stage (string) –
Return django.forms.Form form:
-
fobi.base.
run_form_handlers
(form_entry, request, form, form_element_entries=None)[source]¶ Run form handlers.
Parameters: - form_entry (fobi.models.FormEntry) –
- request (django.http.HttpRequest) –
- form (django.forms.Form) –
- form_element_entries (iterable) –
Return tuple: List of success responses, list of error responses
-
fobi.base.
ensure_autodiscover
()[source]¶ Ensure that plugins are auto-discovered.
The form callbacks registry is intentionally left out, since they will be auto-discovered in any case if other modules are discovered.
-
fobi.base.
collect_plugin_media
(form_element_entries, request=None)[source]¶ Collect the plugin media for form element entries given.
Parameters: - form_element_entries (iterable) – Iterable of
fobi.models.FormElementEntry
instances. - request (django.http.HttpRequest) –
Return dict: Returns a dict containing the ‘js’ and ‘css’ keys. Correspondent values of those keys are lists containing paths to the CSS and JS media files.
- form_element_entries (iterable) – Iterable of
-
fobi.base.
get_registered_themes
()[source]¶ Get registered themes.
Gets a list of registered themes in form of tuple (plugin name, plugin description). If not yet auto-discovered, auto-discovers them.
Return list:
-
fobi.base.
get_registered_theme_uids
(flattern=True)[source]¶ Get registered theme uids.
Gets a list of registered themes in a form of tuple (plugin name, plugin description). If not yet auto-discovered, auto-discovers them.
Return list:
-
fobi.base.
validate_theme_uid
(plugin_uid)[source]¶ Validate the theme uid.
Parameters: plugin_uid (string) – Return bool:
-
class
fobi.base.
BaseFormFieldPluginForm
[source]¶ Bases:
fobi.base.BasePluginForm
Base form for form field plugins.
-
help_text
= <django.forms.fields.CharField object>¶
-
label
= <django.forms.fields.CharField object>¶
-
name
= <django.forms.fields.CharField object>¶
-
plugin_data_fields
= [('name', ''), ('label', ''), ('help_text', ''), ('required', False)]¶
-
required
= <django.forms.fields.BooleanField object>¶
-
-
class
fobi.base.
FormFieldPlugin
(user=None)[source]¶ Bases:
fobi.base.FormElementPlugin
Form field plugin.
-
has_value
= True¶
-
-
class
fobi.base.
FormElementPluginWidgetRegistry
[source]¶ Bases:
fobi.base.BasePluginWidgetRegistry
Registry of form element plugins.
-
type
¶ alias of
FormElementPluginWidget
-
-
class
fobi.base.
FormHandlerPluginWidgetRegistry
[source]¶ Bases:
fobi.base.BasePluginWidgetRegistry
Registry of form handler plugins.
-
type
¶ alias of
FormHandlerPluginWidget
-
-
class
fobi.base.
FormElementPluginWidget
(plugin)[source]¶ Bases:
fobi.base.BasePluginWidget
Form element plugin widget.
-
storage
¶ alias of
FormElementPluginWidgetDataStorage
-
-
class
fobi.base.
FormHandlerPluginWidget
(plugin)[source]¶ Bases:
fobi.base.BasePluginWidget
Form handler plugin widget.
-
storage
¶ alias of
FormHandlerPluginWidgetDataStorage
-
-
fobi.base.
assemble_form_field_widget_class
(base_class, plugin)[source]¶ Assemble form field widget class.
Finish this or remove.
#TODO
-
fobi.base.
get_plugin_widget
(registry, plugin_uid, request=None, as_instance=False, theme=None)[source]¶ Get the plugin widget for the
plugin_uid
given.Looks up in the
registry
provided.Parameters: - registry (fobi.base.BasePluginWidgetRegistry) – Subclass of.
- plugin_uid (str) – UID of the plugin to get the widget for.
- request (django.http.HttpRequest) –
- as_instance (bool) –
- theme (fobi.base.BaseTheme) – Subclass of.
Return BasePluginWidget: Subclass of.
-
fobi.base.
get_form_element_plugin_widget
(plugin_uid, request=None, as_instance=False, theme=None)[source]¶ Get the form element plugin widget for the
plugin_uid
given.Parameters: - registry (fobi.base.BasePluginWidgetRegistry) – Subclass of.
- plugin_uid (str) – UID of the plugin to get the widget for.
- request (django.http.HttpRequest) –
- as_instance (bool) –
- theme (fobi.base.BaseTheme) – Subclass of.
Return BasePluginWidget: Subclass of.
-
fobi.base.
get_form_handler_plugin_widget
(plugin_uid, request=None, as_instance=False, theme=None)[source]¶ Get the form handler plugin widget for the
plugin_uid
given.Parameters: - registry (fobi.base.BasePluginWidgetRegistry) – Subclass of.
- plugin_uid (str) – UID of the plugin to get the widget for.
- request (django.http.HttpRequest) –
- as_instance (bool) –
- theme (fobi.base.BaseTheme) – Subclass of.
Return BasePluginWidget: Subclass of.
fobi.compat module¶
-
class
fobi.compat.
User
(*args, **kwargs)[source]¶ Bases:
django.contrib.auth.models.AbstractUser
Users within the Django authentication system are represented by this model.
Username, password and email are required. Other fields are optional.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
User.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
User.
formelement_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
formentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
formhandler_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
formwizardentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
get_next_by_date_joined
(*moreargs, **morekwargs)¶
-
User.
get_previous_by_date_joined
(*moreargs, **morekwargs)¶
-
User.
groups
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
User.
logentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
registrationprofile
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
User.
savedformdataentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
user_permissions
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
fobi.conf module¶
-
fobi.conf.
get_setting
(setting, override=None)[source]¶ Get setting.
Get a setting from fobi conf module, falling back to the default.
If override is not None, it will be used instead of the setting.
Parameters: - setting – String with setting name
- override – Value to use when no setting is available. Defaults to None.
Returns: Setting value.
fobi.constants module¶
fobi.context_processors module¶
fobi.data_structures module¶
-
class
fobi.data_structures.
SortableDict
(data=None)[source]¶ Bases:
dict
SortableDict.
A dictionary that keeps its keys in the order in which they’re inserted. Very similar to (and partly based on)
SortedDict
of theDjango
, but has several additional methods implemented, such as:insert_before_key
andinsert_after_key
.-
insert
(index, key, value)[source]¶ Inserts the key, value pair before the item with the given index.
-
insert_after_key
(target_key, key, value, fail_silently=True)[source]¶ Insert the {
key
:value
} after thetarget_key
.Parameters: - target_key (immutable) –
- key (immutable) –
- value (mutable) –
- fail_silently (boolean) –
- offset (int) –
Return bool:
-
insert_before_key
(target_key, key, value, fail_silently=True, offset=0)[source]¶ Insert the {
key
:value
} before thetarget_key
.Parameters: - target_key (immutable) –
- key (immutable) –
- value (mutable) –
- fail_silently (boolean) –
- offset (int) –
Return bool:
-
iteritems
()¶ Iter items (internal method).
-
iterkeys
()¶
-
itervalues
()¶ Iter values (internal method).
-
move_after_key
(source_key, target_key, fail_silently=True)[source]¶ Move the {
key
:value
} after the givensource_key
.Parameters: - source_key (immutable) –
- target_key (immutable) –
- fail_silently (boolean) –
Return bool:
-
fobi.decorators module¶
-
fobi.decorators.
permissions_required
(perms, satisfy='all', login_url=None, raise_exception=False)[source]¶ Check for the permissions given based on the strategy chosen.
Parameters: - perms (iterable) –
- satisfy (string) – Allowed values are “all” and “any”.
- login_url (string) –
- raise_exception (bool) – If set to True, the
PermissionDenied
exception is raised on failures.
Return bool: Example: >>> @login_required >>> @permissions_required(satisfy='any', perms=[ >>> 'fobi.add_formentry', >>> 'fobi.change_formentry', >>> 'fobi.delete_formentry', >>> 'fobi.add_formelemententry', >>> 'fobi.change_formelemententry', >>> 'fobi.delete_formelemententry', >>> ]) >>> def edit_dashboard(request): >>> # your code
-
fobi.decorators.
all_permissions_required
(perms, login_url=None, raise_exception=False)[source]¶ Check for the permissions given based on SATISFY_ALL strategy chosen.
Example: >>> @login_required >>> @all_permissions_required([ >>> 'fobi.add_formentry', >>> 'fobi.change_formentry', >>> 'fobi.delete_formentry', >>> 'fobi.add_formelemententry', >>> 'fobi.change_formelemententry', >>> 'fobi.delete_formelemententry', >>> ]) >>> def edit_dashboard(request): >>> # your code
-
fobi.decorators.
any_permission_required
(perms, login_url=None, raise_exception=False)[source]¶ Check for the permissions given based on SATISFY_ANY strategy chosen.
Example: >>> @login_required >>> @any_permission_required([ >>> 'fobi.add_formentry', >>> 'fobi.change_formentry', >>> 'fobi.delete_formentry', >>> 'fobi.add_formelemententry', >>> 'fobi.change_formelemententry', >>> 'fobi.delete_formelemententry', >>> ]) >>> def edit_dashboard(request): >>> # your code
fobi.defaults module¶
fobi.discover module¶
fobi.dynamic module¶
-
fobi.dynamic.
assemble_form_class
(form_entry, base_class=<class 'django.forms.forms.BaseForm'>, request=None, origin=None, origin_kwargs_update_func=None, origin_return_func=None, form_element_entries=None)[source]¶ Assemble a form class by given entry.
Parameters: - form_entry –
- base_class –
- request (django.http.HttpRequest) –
- origin (string) –
- origin_kwargs_update_func (callable) –
- origin_return_func (callable) –
- form_element_entries (iterable) – If given, used instead of
form_entry.formelemententry_set.all
(no additional database hit).
fobi.exceptions module¶
-
exception
fobi.exceptions.
ImproperlyConfigured
[source]¶ Bases:
fobi.exceptions.BaseException
Improperly configured.
Exception raised when developer didn’t configure/write the code properly.
-
exception
fobi.exceptions.
InvalidRegistryItemType
[source]¶ Bases:
exceptions.ValueError
,fobi.exceptions.BaseException
Invalid registry item type.
Raised when an attempt is made to register an item in the registry which does not have a proper type.
-
exception
fobi.exceptions.
DoesNotExist
[source]¶ Bases:
fobi.exceptions.BaseException
Raised when something does not exist.
-
exception
fobi.exceptions.
ThemeDoesNotExist
[source]¶ Bases:
fobi.exceptions.DoesNotExist
Raised when no theme with given uid can be found.
-
exception
fobi.exceptions.
PluginDoesNotExist
[source]¶ Bases:
fobi.exceptions.DoesNotExist
Raised when no plugin with given uid can be found.
-
exception
fobi.exceptions.
FormElementPluginDoesNotExist
[source]¶ Bases:
fobi.exceptions.PluginDoesNotExist
Raised when no form element plugin with given uid can be found.
-
exception
fobi.exceptions.
FormHandlerPluginDoesNotExist
[source]¶ Bases:
fobi.exceptions.PluginDoesNotExist
Raised when no form handler plugin with given uid can be found.
-
exception
fobi.exceptions.
NoDefaultThemeSet
[source]¶ Bases:
fobi.exceptions.ImproperlyConfigured
Raised when no active theme is chosen.
-
exception
fobi.exceptions.
FormPluginError
[source]¶ Bases:
fobi.exceptions.BaseException
Base error for form elements and handlers.
-
exception
fobi.exceptions.
FormElementPluginError
[source]¶ Bases:
fobi.exceptions.FormPluginError
Raised when form element plugin error occurs.
-
exception
fobi.exceptions.
FormHandlerPluginError
[source]¶ Bases:
fobi.exceptions.FormPluginError
Raised when form handler plugin error occurs.
-
exception
fobi.exceptions.
FormCallbackError
[source]¶ Bases:
fobi.exceptions.FormPluginError
Raised when form callback error occurs.
fobi.form_importers module¶
-
class
fobi.form_importers.
BaseFormImporter
(form_entry_cls, form_element_entry_cls, form_properties=None, form_data=None)[source]¶ Bases:
object
Base importer.
-
description
= None¶
-
field_properties_mapping
= None¶
-
field_type_prop_name
= None¶
-
fields_mapping
= None¶
-
name
= None¶
-
position_prop_name
= None¶
-
templates
= None¶
-
uid
= None¶
-
wizard
= None¶
-
-
class
fobi.form_importers.
FormImporterPluginRegistry
[source]¶ Bases:
fobi.base.BaseRegistry
Form importer plugins registry.
-
type
¶ alias of
BaseFormImporter
-
fobi.form_utils module¶
fobi.forms module¶
-
class
fobi.forms.
FormEntryForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
Form for
fobi.models.FormEntry
model.-
class
Meta
[source]¶ Meta class.
-
fields
= ('name', 'is_public', 'success_page_title', 'success_page_message', 'action')¶
-
model
¶ alias of
FormEntry
-
-
FormEntryForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7f383a3acb90>), ('is_public', <django.forms.fields.BooleanField object at 0x7f383a34a410>), ('success_page_title', <django.forms.fields.CharField object at 0x7f383a34a450>), ('success_page_message', <django.forms.fields.CharField object at 0x7f383a303e50>), ('action', <django.forms.fields.CharField object at 0x7f383a30f050>)])¶
-
FormEntryForm.
declared_fields
= OrderedDict()¶
-
FormEntryForm.
media
¶
-
class
-
class
fobi.forms.
FormFieldsetEntryForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
Form for
fobi.models.FormFieldsetEntry
model.-
FormFieldsetEntryForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7f383a30f2d0>)])¶
-
FormFieldsetEntryForm.
declared_fields
= OrderedDict()¶
-
FormFieldsetEntryForm.
media
¶
-
-
fobi.forms.
FormElementEntryFormSet
¶ alias of
FormElementEntryFormFormSet
-
class
fobi.forms.
BulkChangeFormElementPluginsForm
(*args, **kwargs)[source]¶ Bases:
fobi.forms.BaseBulkChangePluginsForm
Bulk change form element plugins form.
-
class
Meta
[source]¶ Meta class.
-
fields
= ['groups', 'groups_action', 'users', 'users_action']¶
-
model
¶ alias of
FormElement
-
-
BulkChangeFormElementPluginsForm.
base_fields
= OrderedDict([('groups', <django.forms.models.ModelMultipleChoiceField object at 0x7f383a133d50>), ('groups_action', <django.forms.fields.ChoiceField object at 0x7f383a1337d0>), ('users', <django.forms.models.ModelMultipleChoiceField object at 0x7f383a133b50>), ('users_action', <django.forms.fields.ChoiceField object at 0x7f383a1336d0>), ('selected_plugins', <django.forms.fields.CharField object at 0x7f383a133590>)])¶
-
BulkChangeFormElementPluginsForm.
declared_fields
= OrderedDict([('selected_plugins', <django.forms.fields.CharField object at 0x7f383a133590>), ('users_action', <django.forms.fields.ChoiceField object at 0x7f383a1336d0>), ('groups_action', <django.forms.fields.ChoiceField object at 0x7f383a1337d0>)])¶
-
BulkChangeFormElementPluginsForm.
media
¶
-
class
-
class
fobi.forms.
BulkChangeFormHandlerPluginsForm
(*args, **kwargs)[source]¶ Bases:
fobi.forms.BaseBulkChangePluginsForm
Bulk change form handler plugins form.
-
class
Meta
[source]¶ Meta class.
-
fields
= ['groups', 'groups_action', 'users', 'users_action']¶
-
model
¶ alias of
FormHandler
-
-
BulkChangeFormHandlerPluginsForm.
base_fields
= OrderedDict([('groups', <django.forms.models.ModelMultipleChoiceField object at 0x7f383a13d250>), ('groups_action', <django.forms.fields.ChoiceField object at 0x7f383a1337d0>), ('users', <django.forms.models.ModelMultipleChoiceField object at 0x7f383a13d050>), ('users_action', <django.forms.fields.ChoiceField object at 0x7f383a1336d0>), ('selected_plugins', <django.forms.fields.CharField object at 0x7f383a133590>)])¶
-
BulkChangeFormHandlerPluginsForm.
declared_fields
= OrderedDict([('selected_plugins', <django.forms.fields.CharField object at 0x7f383a133590>), ('users_action', <django.forms.fields.ChoiceField object at 0x7f383a1336d0>), ('groups_action', <django.forms.fields.ChoiceField object at 0x7f383a1337d0>)])¶
-
BulkChangeFormHandlerPluginsForm.
media
¶
-
class
-
class
fobi.forms.
ImportFormEntryForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]¶ Bases:
django.forms.forms.Form
Import form entry form.
-
base_fields
= OrderedDict([('file', <django.forms.fields.FileField object at 0x7f383a13d410>)])¶
-
declared_fields
= OrderedDict([('file', <django.forms.fields.FileField object at 0x7f383a13d410>)])¶
-
media
¶
-
-
class
fobi.forms.
FormHandlerForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]¶ Bases:
django.forms.models.ModelForm
FormHandler form.
-
FormHandlerForm.
base_fields
= OrderedDict([('users', <django.forms.models.ModelMultipleChoiceField object at 0x7f383a123d50>), ('groups', <django.forms.models.ModelMultipleChoiceField object at 0x7f383a123f50>)])¶
-
FormHandlerForm.
declared_fields
= OrderedDict()¶
-
FormHandlerForm.
media
¶
-
-
class
fobi.forms.
FormHandlerEntryForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]¶ Bases:
django.forms.models.ModelForm
FormHandlerEntry form.
-
class
Meta
[source]¶ Meta class.
-
fields
= ('form_entry', 'plugin_data', 'plugin_uid')¶
-
model
¶ alias of
FormHandlerEntry
-
-
FormHandlerEntryForm.
base_fields
= OrderedDict([('form_entry', <django.forms.models.ModelChoiceField object at 0x7f383a1332d0>), ('plugin_data', <django.forms.fields.CharField object at 0x7f383a1334d0>), ('plugin_uid', <django.forms.fields.ChoiceField object at 0x7f383a123cd0>)])¶
-
FormHandlerEntryForm.
declared_fields
= OrderedDict([('plugin_uid', <django.forms.fields.ChoiceField object at 0x7f383a123cd0>)])¶
-
FormHandlerEntryForm.
media
¶
-
class
fobi.helpers module¶
Helpers module. This module can be safely imported from any fobi (sub)module, since it never imports from any of the fobi (sub)modules (except for the fobi.constants and fobi.exceptions modules).
-
fobi.helpers.
iterable_to_dict
(items, key_attr_name)[source]¶ Converts iterable of certain objects to dict.
Parameters: - items (iterable) –
- key_attr_name (string) – Attribute to use as a dictionary key.
Return dict:
-
fobi.helpers.
map_field_name_to_label
(form)[source]¶ Takes a form and creates label to field name map.
Parameters: form (django.forms.Form) – Instance of django.forms.Form
.Return dict:
-
fobi.helpers.
clean_dict
(source, keys=[], values=[])[source]¶ Removes given keys and values from dictionary.
Parameters: - source (dict) –
- keys (iterable) –
- values (iterable) –
Return dict:
-
fobi.helpers.
two_dicts_to_string
(headers, data, html_element='p')[source]¶ Two dicts to string.
Takes two dictionaries, assuming one contains a mapping keys to titles and another keys to data. Joins as string and returns wrapped into HTML “p” tag.
-
fobi.helpers.
ensure_unique_filename
(destination)[source]¶ Makes sure filenames are never overwritten.
Parameters: destination (string) – Return string:
-
fobi.helpers.
handle_uploaded_file
(upload_dir, image_file)[source]¶ Handle uploaded files.
Parameters: image_file (django.core.files.uploadedfile.InMemoryUploadedFile) – Return string: Path to the image (relative).
-
fobi.helpers.
clone_file
(upload_dir, source_filename, relative_path=True)[source]¶ Clones the file.
Parameters: source_filename (string) – Source filename. Return string: Filename of the cloned file.
-
fobi.helpers.
get_registered_models
(ignore=[])[source]¶ Gets registered models as list.
Parameters: ignore (iterable) – Ignore the following content types (should be in app_label.model
format (exampleauth.User
).Return list:
-
fobi.helpers.
admin_change_url
(app_label, module_name, object_id, extra_path='', url_title=None)[source]¶ Gets an admin change URL for the object given.
Parameters: - app_label (str) –
- module_name (str) –
- object_id (int) –
- extra_path (str) –
- url_title (str) – If given, an HTML a tag is returned with url_title as the tag title. If left to None just the URL string is returned.
Return str:
-
fobi.helpers.
uniquify_sequence
(sequence)[source]¶ Uniqify sequence.
Makes sure items in the given sequence are unique, having the original order preserved.
Parameters: sequence (iterable) – Return list:
-
fobi.helpers.
combine_dicts
(headers, data)[source]¶ Combine dicts.
Takes two dictionaries, assuming one contains a mapping keys to titles and another keys to data. Joins as string and returns a result dict.
-
fobi.helpers.
update_plugin_data
(entry, request=None)[source]¶ Update plugin data.
Update plugin data of a given entry.
-
fobi.helpers.
get_select_field_choices
(raw_choices_data)[source]¶ Get select field choices.
Used in
radio
,select
and other choice based fields.Parameters: raw_choices_data (str) – Return list:
-
fobi.helpers.
validate_initial_for_choices
(plugin_form, field_name_choices='choices', field_name_initial='initial')[source]¶ Validate init for choices. Validates the initial value for the choices given.
Parameters: plugin_form (fobi.base.BaseFormFieldPluginForm) –
-
fobi.helpers.
validate_initial_for_multiple_choices
(plugin_form, field_name_choices='choices', field_name_initial='initial')[source]¶ Validates the initial value for the multiple choices given.
Parameters: plugin_form (fobi.base.BaseFormFieldPluginForm) –
-
fobi.helpers.
validate_submit_value_as
(value)[source]¶ Validates the SUBMIT_AS_VALUE.
Parameters: value (str) –
-
fobi.helpers.
get_app_label_and_model_name
(path)[source]¶ Gets app_label and model_name from the path given.
Parameters: path (str) – Dotted path to the model (without ”.model”, as stored in the Django ContentType model. Return tuple: app_label, model_name
-
class
fobi.helpers.
StrippedRequest
(request)[source]¶ Bases:
object
Stripped request object.
-
META
¶ Request meta stripped down.
A standard Python dictionary containing all available HTTP headers. Available headers depend on the client and server, but here are some examples:
- HTTP_ACCEPT_ENCODING: Acceptable encodings for the response.
- HTTP_ACCEPT_LANGUAGE: Acceptable languages for the response.
- HTTP_HOST: The HTTP Host header sent by the client.
- HTTP_REFERER: The referring page, if any.
- HTTP_USER_AGENT: The clients user-agent string.
- QUERY_STRING: The query string, as a single (unparsed) string.
- REMOTE_ADDR: The IP address of the client.
-
is_ajax
()[source]¶ Is ajax?
Returns True if the request was made via an XMLHttpRequest, by checking the HTTP_X_REQUESTED_WITH header for the string ‘XMLHttpRequest’.
-
is_secure
()[source]¶ Is secure.
Returns True if the request is secure; that is, if it was made with HTTPS.
-
path
¶ Path.
A string representing the full path to the requested page, not including the scheme or domain.
-
fobi.models module¶
-
class
fobi.models.
AbstractPluginModel
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Abstract plugin model.
Used when
fobi.settings.RESTRICT_PLUGIN_ACCESS
is set to True.Properties: - plugin_uid (str): Plugin UID.
- users (django.contrib.auth.models.User): White list of the users allowed to use the plugin.
- groups (django.contrib.auth.models.Group): White list of the user groups allowed to use the plugin.
-
AbstractPluginModel.
groups
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
AbstractPluginModel.
groups_list
()[source]¶ Groups list.
Flat list (comma separated string) of groups allowed to use the plugin. Used in Django admin.
Return string:
-
AbstractPluginModel.
users
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
fobi.models.
FormElement
(*args, **kwargs)[source]¶ Bases:
fobi.models.AbstractPluginModel
Form element.
Form field plugin. Used when
fobi.settings.RESTRICT_PLUGIN_ACCESS
is set to True.Properties: - plugin_uid (str): Plugin UID.
- users (django.contrib.auth.models.User): White list of the users allowed to use the form element plugin.
- groups (django.contrib.auth.models.Group): White list of the user groups allowed to use the form element plugin.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
FormElement.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
FormElement.
groups
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormElement.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormElement.
objects
= <django.db.models.manager.Manager object>¶
-
FormElement.
plugin_uid
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormElement.
users
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
fobi.models.
FormHandler
(*args, **kwargs)[source]¶ Bases:
fobi.models.AbstractPluginModel
Form handler plugin. Used when
fobi.settings.RESTRICT_PLUGIN_ACCESS
is set to True.Properties: - plugin_uid (str): Plugin UID.
- users (django.contrib.auth.models.User): White list of the users allowed to use the form handler plugin.
- groups (django.contrib.auth.models.Group): White list of the user groups allowed to use the form handler plugin.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
FormHandler.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
FormHandler.
groups
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormHandler.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormHandler.
objects
= <django.db.models.manager.Manager object>¶
-
FormHandler.
plugin_uid
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormHandler.
users
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
fobi.models.
AbstractPluginEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Abstract plugin entry.
Properties: - form_entry (fobi.models.FormEntry): Form to which the field plugin belongs to.
- plugin_uid (str): Plugin UID.
- plugin_data (str): JSON formatted string with plugin data.
-
AbstractPluginEntry.
form_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
AbstractPluginEntry.
form_entry_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
AbstractPluginEntry.
get_plugin
(fetch_related_data=False, request=None)[source]¶ Get plugin.
Gets the plugin class (by
plugin_uid
property), makes an instance of it, serves the data stored inplugin_data
field (if available). Once all is done, plugin is ready to be rendered.Parameters: fetch_related_data (bool) – When set to True, plugin is told to re-fetch all related data (stored in models or other sources). Return fobi.base.BasePlugin: Subclass of fobi.base.BasePlugin
.
-
AbstractPluginEntry.
plugin_data
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
class
fobi.models.
FormWizardEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Form wizard entry.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
FormWizardEntry.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
FormWizardEntry.
formentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormWizardEntry.
get_absolute_url
()[source]¶ Get absolute URL.
Absolute URL, which goes to the dashboard workspace page.
Return string:
-
FormWizardEntry.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormWizardEntry.
is_cloneable
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormWizardEntry.
is_public
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormWizardEntry.
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormWizardEntry.
objects
= <django.db.models.manager.Manager object>¶
-
FormWizardEntry.
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormWizardEntry.
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FormWizardEntry.
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
fobi.models.
FormEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Form entry.
Properties: - user (django.contrib.auth.models.User: User owning the plugin.
- wizard (str): Form wizard to which the form entry belongs to.
- name (str): Form name.
- slug (str): Form slug.
- description (str): Form description.
- is_public (bool): If set to True, is visible to public.
- is_clonable (bool): If set to True, is clonable.
- position (int): Ordering position in the wizard.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
FormEntry.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
FormEntry.
action
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
form_wizard_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FormEntry.
form_wizard_entry_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
formelemententry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormEntry.
formfieldsetentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormEntry.
formhandlerentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormEntry.
get_absolute_url
()[source]¶ Get absolute URL.
Absolute URL, which goes to the dashboard workspace page.
Return string:
-
FormEntry.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
is_cloneable
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
is_public
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
objects
= <django.db.models.manager.Manager object>¶
-
FormEntry.
position
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
savedformdataentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormEntry.
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
success_page_message
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
success_page_title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
updated
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormEntry.
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FormEntry.
user_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
class
fobi.models.
FormElementEntry
(*args, **kwargs)[source]¶ Bases:
fobi.models.AbstractPluginEntry
Form field entry.
Properties: - form (fobi.models.FormEntry): Form to which the field plugin belongs to.
- plugin_uid (str): Plugin UID.
- plugin_data (str): JSON formatted string with plugin data.
- form_fieldset_entry: Fieldset.
- position (int): Entry position.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
FormElementEntry.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
FormElementEntry.
form_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FormElementEntry.
form_fieldset_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FormElementEntry.
form_fieldset_entry_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormElementEntry.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormElementEntry.
objects
= <django.db.models.manager.Manager object>¶
-
FormElementEntry.
plugin_uid
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormElementEntry.
position
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
class
fobi.models.
FormFieldsetEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Form fieldset entry.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
FormFieldsetEntry.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
FormFieldsetEntry.
form_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FormFieldsetEntry.
form_entry_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormFieldsetEntry.
formelemententry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
FormFieldsetEntry.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormFieldsetEntry.
is_repeatable
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormFieldsetEntry.
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormFieldsetEntry.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
fobi.models.
FormHandlerEntry
(*args, **kwargs)[source]¶ Bases:
fobi.models.AbstractPluginEntry
Form handler entry.
Properties: - form_entry (fobi.models.FormEntry): Form to which the field plugin belongs to.
- plugin_uid (str): Plugin UID.
- plugin_data (str): JSON formatted string with plugin data.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
FormHandlerEntry.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
FormHandlerEntry.
form_entry
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
FormHandlerEntry.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
FormHandlerEntry.
objects
= <django.db.models.manager.Manager object>¶
-
FormHandlerEntry.
plugin_uid
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
fobi.settings module¶
- RESTRICT_PLUGIN_ACCESS (bool): If set to True, (Django) permission system for fobi plugins is enabled.
- FORM_ELEMENT_PLUGINS_MODULE_NAME (str): Name of the module to placed in the (external) apps in which the fobi form element plugin code should be implemented and registered.
- FORM_HANDLER_PLUGINS_MODULE_NAME (str): Name of the module to placed in the (external) apps in which the fobi form handler plugin code should be implemented and registered.
- FORM_CALLBACKS_MODULE_NAME (str): Name of the module to placed in the (external) apps in which the fobi form callback code should be implemented and registered.
- FORM_HANDLER_PLUGINS_EXECUTION_ORDER (tuple): Order in which the form handler plugins are to be executed.
- DEBUG
fobi.test module¶
fobi.utils module¶
Another helper module. This module can NOT be safely imported from any fobi (sub)module - thus should be imported carefully.
-
fobi.utils.
get_allowed_plugin_uids
(PluginModel, user)[source]¶ Get allowed plugins uids for user given.
Parameters: - PluginModel (fobi.models.AbstractPluginModel) – Subclass of
fobi.models.AbstractPluginModel
. - user (django.contrib.auth.models.User) –
Return list: - PluginModel (fobi.models.AbstractPluginModel) – Subclass of
-
fobi.utils.
get_user_plugins
(get_allowed_plugin_uids_func, get_registered_plugins_func, registry, user)[source]¶ Get user plugins.
Gets a list of user plugins in a form if tuple (plugin name, plugin description). If not yet autodiscovered, autodiscovers them.
Parameters: - get_allowed_plugin_uids_func (callable) –
- get_registered_plugins_func (callable) –
- registry (fobi.base.BaseRegistry) – Subclass of
fobi.base.BaseRegistry
instance. - user (django.contrib.auth.models.User) –
Return list:
-
fobi.utils.
get_user_plugin_uids
(get_allowed_plugin_uids_func, get_registered_plugin_uids_func, registry, user)[source]¶ Gets a list of user plugin uids as a list.
If not yet auto-discovered, auto-discovers them.
Parameters: - get_allowed_plugin_uids_func (callable) –
- get_registered_plugin_uids_func (callable) –
- registry (fobi.base.BaseRegistry) – Subclass of
fobi.base.BaseRegistry
instance. - user (django.contrib.auth.models.User) –
Return list:
-
fobi.utils.
sync_plugins
()[source]¶ Sync registered plugins.
Syncs the registered plugin list with data in
fobi.models.FormFieldPluginModel
andfobi.models.FormHandlerPluginModel
.
-
fobi.utils.
get_allowed_form_element_plugin_uids
(user)[source]¶ Get allowed form element plugin uids.
-
fobi.utils.
get_allowed_form_handler_plugin_uids
(user)[source]¶ Get allowed form handler plugin uids.
-
fobi.utils.
get_user_form_handler_plugins
(user, exclude_used_singles=False, used_form_handler_plugin_uids=[])[source]¶ Get list of plugins allowed for user.
Parameters: - user (django.contrib.auth.models.User) –
- exclude_used_singles (bool) –
- used_form_handler_plugin_uids (list) –
Return list:
-
fobi.utils.
get_user_plugins_grouped
(get_allowed_plugin_uids_func, get_registered_plugins_grouped_func, registry, user, sort_items=True)[source]¶ Get user plugins grouped.
Parameters: - get_allowed_plugin_uids_func (callable) –
- get_registered_plugins_grouped_func (callable) –
- registry (fobi.base.BaseRegistry) – Subclass of
fobi.base.BaseRegistry
instance. - user (django.contrib.auth.models.User) –
- sort_items (bool) –
Return dict:
fobi.validators module¶
fobi.views module¶
Views.
-
fobi.views.
create_form_entry
(request, *args, **kwargs)[source]¶ Create form entry.
Parameters: - request (django.http.HttpRequest) –
- theme (fobi.base.BaseTheme) – Theme instance.
- template_name (str) –
Return django.http.HttpResponse:
-
fobi.views.
edit_form_entry
(request, *args, **kwargs)[source]¶ Edit form entry.
Parameters: - request (django.http.HttpRequest) –
- form_entry_id (int) –
- theme (fobi.base.BaseTheme) – Theme instance.
- template_name (str) –
Return django.http.HttpResponse:
-
fobi.views.
delete_form_entry
(request, *args, **kwargs)[source]¶ Delete form entry.
Parameters: - request (django.http.HttpRequest) –
- form_entry_id (int) –
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
add_form_element_entry
(request, *args, **kwargs)[source]¶ Add form element entry.
Parameters: - request (django.http.HttpRequest) –
- form_entry_id (int) –
- form_element_plugin_uid (int) –
- theme (fobi.base.BaseTheme) – Theme instance.
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
edit_form_element_entry
(request, *args, **kwargs)[source]¶ Edit form element entry.
Parameters: - request (django.http.HttpRequest) –
- form_element_entry_id (int) –
- fobi.base.BaseTheme – Theme instance.
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
delete_form_element_entry
(request, *args, **kwargs)[source]¶ Delete form element entry.
Parameters: - request (django.http.HttpRequest) –
- form_element_entry_id (int) –
Return django.http.HttpResponse:
-
fobi.views.
add_form_handler_entry
(request, *args, **kwargs)[source]¶ Add form handler entry.
Parameters: - request (django.http.HttpRequest) –
- form_entry_id (int) –
- form_handler_plugin_uid (int) –
- theme (fobi.base.BaseTheme) – Theme instance.
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
edit_form_handler_entry
(request, *args, **kwargs)[source]¶ Edit form handler entry.
Parameters: - request (django.http.HttpRequest) –
- form_handler_entry_id (int) –
- theme (fobi.base.BaseTheme) – Theme instance.
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
delete_form_handler_entry
(request, *args, **kwargs)[source]¶ Delete form handler entry.
Parameters: - request (django.http.HttpRequest) –
- form_handler_entry_id (int) –
Return django.http.HttpResponse:
-
fobi.views.
dashboard
(request, *args, **kwargs)[source]¶ Dashboard.
Parameters: - request (django.http.HttpRequest) –
- theme (fobi.base.BaseTheme) – Theme instance.
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
view_form_entry
(request, form_entry_slug, theme=None, template_name=None)[source]¶ View created form.
Parameters: - request (django.http.HttpRequest) –
- form_entry_slug (string) –
- theme (fobi.base.BaseTheme) – Theme instance.
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
form_entry_submitted
(request, form_entry_slug=None, template_name=None)[source]¶ Form entry submitted.
Parameters: - request (django.http.HttpRequest) –
- form_entry_slug (string) –
- template_name (string) –
Return django.http.HttpResponse:
-
fobi.views.
export_form_entry
(request, *args, **kwargs)[source]¶ Export form entry to JSON.
Parameters: - request (django.http.HttpRequest) –
- form_entry_id (int) –
- template_name (string) –
Return django.http.HttpResponse:
fobi.widgets module¶
Module contents¶
Quick start¶
Tutorial for very quick start with django-fobi
. Consists of
several parts listed below:
- Part 1: Standard Django installation
- Part 2: Integration with DjangoCMS (coming soon)
Part 1: standard Django installation¶
Example project code available here.
Installation and configuration¶
Install the package in your environment.¶
pip install django-fobi
INSTALLED_APPS¶
Add fobi
core and the plugins to the INSTALLED_APPS
of the your
settings module.
- The core.
'fobi',
- The preferred theme. Bootstrap 3 theme is the default. If you have chosen a
different theme, update the value of
FOBI_DEFAULT_THEME
accordingly.
'fobi.contrib.themes.bootstrap3',
- The form field plugins. Plugins are like blocks. You are recommended to have them all installed. Note, that the following plugins do not have additional dependencies, while some others (like fobi.contrib.plugins.form_elements.security.captcha or fobi.contrib.plugins.form_elements.security.recaptcha would require additional packages to be installed. If so, make sure to have installed and configured those dependencies prior adding the dependant add-ons to the settings module.
'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.regex',
'fobi.contrib.plugins.form_elements.fields.select',
'fobi.contrib.plugins.form_elements.fields.select_model_object',
'fobi.contrib.plugins.form_elements.fields.select_multiple',
'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
'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',
- The presentational form elements (images, texts, videos).
'easy_thumbnails', # Required by `content_image` plugin
'fobi.contrib.plugins.form_elements.content.content_image',
'fobi.contrib.plugins.form_elements.content.content_text',
'fobi.contrib.plugins.form_elements.content.content_video',
- Form handlers. Note, that some of them may require database sync/migration.
'fobi.contrib.plugins.form_handlers.db_store',
'fobi.contrib.plugins.form_handlers.http_repost',
'fobi.contrib.plugins.form_handlers.mail',
Putting all together, you would have something like this.
INSTALLED_APPS = (
# Used by fobi
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
# ...
# Core
'fobi',
# Theme
'fobi.contrib.themes.bootstrap3',
# Form field 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.regex',
'fobi.contrib.plugins.form_elements.fields.select',
'fobi.contrib.plugins.form_elements.fields.select_model_object',
'fobi.contrib.plugins.form_elements.fields.select_multiple',
'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
'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',
# Form element plugins
'easy_thumbnails', # Required by `content_image` plugin
'fobi.contrib.plugins.form_elements.content.content_image',
'fobi.contrib.plugins.form_elements.content.content_text',
'fobi.contrib.plugins.form_elements.content.content_video',
# Form handlers
'fobi.contrib.plugins.form_handlers.db_store',
'fobi.contrib.plugins.form_handlers.http_repost',
'fobi.contrib.plugins.form_handlers.mail',
# ...
)
TEMPLATE_CONTEXT_PROCESSORS¶
Add django.core.context_processors.request
and
fobi.context_processors.theme
to TEMPLATE_CONTEXT_PROCESSORS
of
your settings module.
TEMPLATE_CONTEXT_PROCESSORS = (
# ...
"django.core.context_processors.request",
"fobi.context_processors.theme", # Obligatory
"fobi.context_processors.dynamic_values", # Optional
# ...
)
urlpatterns¶
Add the following line to urlpatterns
of your urls module.
urlpatterns = [
# ...
# DB Store plugin URLs
url(r'^fobi/plugins/form-handlers/db-store/',
include('fobi.contrib.plugins.form_handlers.db_store.urls')),
# View URLs
url(r'^fobi/', include('fobi.urls.view')),
# Edit URLs
url(r'^fobi/', include('fobi.urls.edit')),
# ...
]
Update the database¶
- First you should be syncing/migrating the database. Depending on your Django version and migration app, this step may vary. Typically as follows:
$ ./manage.py syncdb
$ ./manage.py migrate --fake-initial
- Sync installed
fobi
plugins. Go to terminal and type the following command.
$ ./manage.py fobi_sync_plugins
Specify the active theme¶
Specify the default theme in your settings module.
FOBI_DEFAULT_THEME = 'bootstrap3'
Permissions¶
fobi
has been built with permissions in mind. Every single form element
plugin or handler is permission based. If user hasn’t been given permission
to work with a form element or a form handler plugin, he won’t be. If you want
to switch the permission checks off, set the value of
FOBI_RESTRICT_PLUGIN_ACCESS
to False in your settings module.
FOBI_RESTRICT_PLUGIN_ACCESS = False
Otherwise, after having completed all the steps above, do log into the Django administration and assign the permissions (to certain user or a group) for every single form element or form handler plugin. Bulk assignments work as well.
Also, make sure to have the Django model permissions set for following models:
Part 2: Integration with DjangoCMS¶
Coming soon...