fobi.contrib.plugins.form_handlers.db_store package

Submodules

fobi.contrib.plugins.form_handlers.db_store.admin module

class fobi.contrib.plugins.form_handlers.db_store.admin.SavedFormDataEntryAdmin(model, admin_site)[source]

Bases: fobi.contrib.plugins.form_handlers.db_store.admin.BaseSavedFormDataEntryAdmin

Saved form data entry admin.

class Meta[source]

Bases: object

Meta class.

app_label = <django.utils.functional.lazy.<locals>.__proxy__ object>
actions = ['export_data']
fieldsets = ((None, {'fields': ('form_entry', 'user')}), (<django.utils.functional.lazy.<locals>.__proxy__ object>, {'fields': ('formatted_saved_data', 'created')}), (<django.utils.functional.lazy.<locals>.__proxy__ object>, {'classes': ('collapse',), 'fields': ('form_data_headers', 'saved_data')}))
list_display = ('form_entry', 'user', 'formatted_saved_data', 'created')
list_filter = ('form_entry', 'user')
media
only_args = ['form_entry']
readonly_fields = ('created', 'formatted_saved_data')
class fobi.contrib.plugins.form_handlers.db_store.admin.SavedFormWizardDataEntryAdmin(model, admin_site)[source]

Bases: fobi.contrib.plugins.form_handlers.db_store.admin.BaseSavedFormDataEntryAdmin

Saved form wizard data entry admin.

class Meta[source]

Bases: object

Meta class.

app_label = <django.utils.functional.lazy.<locals>.__proxy__ object>
actions = ['export_data']
fieldsets = ((None, {'fields': ('form_wizard_entry', 'user')}), (<django.utils.functional.lazy.<locals>.__proxy__ object>, {'fields': ('formatted_saved_data', 'created')}), (<django.utils.functional.lazy.<locals>.__proxy__ object>, {'classes': ('collapse',), 'fields': ('form_data_headers', 'saved_data')}))
list_display = ('form_wizard_entry', 'user', 'formatted_saved_data', 'created')
list_filter = ('form_wizard_entry', 'user')
media
only_args = ['form_wizard_entry']
readonly_fields = ('created', 'formatted_saved_data')

fobi.contrib.plugins.form_handlers.db_store.apps module

class fobi.contrib.plugins.form_handlers.db_store.apps.Config(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

Config.

label = 'fobi_contrib_plugins_form_handlers_db_store'
name = 'fobi.contrib.plugins.form_handlers.db_store'

fobi.contrib.plugins.form_handlers.db_store.base module

class fobi.contrib.plugins.form_handlers.db_store.base.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.lazy.<locals>.__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.
save_form_data_entry(form_entry, request, field_name_to_label_map, cleaned_data)[source]

Save form data entry.

Might be used in integration plugins.

uid = 'db_store'
class fobi.contrib.plugins.form_handlers.db_store.base.DBStoreWizardHandlerPlugin(user=None)[source]

Bases: fobi.base.FormWizardHandlerPlugin

DB store form wizard handler plugin.

Can be used only once per form.

allow_multiple = False
custom_actions(form_wizard_entry, request=None)[source]

Custom actions.

Adding a link to view the saved form entries.

Return iterable:
 
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
run(form_wizard_entry, request, form_list, form_wizard, form_element_entries=None)[source]

Run.

Parameters:
uid = 'db_store'

fobi.contrib.plugins.form_handlers.db_store.callbacks module

class fobi.contrib.plugins.form_handlers.db_store.callbacks.AutoFormDbStore[source]

Bases: fobi.base.FormCallback

Auto save form entries.

Note, that this callback is not active. In order to activate it, you should import the AutoFormDbStore and register it using the callback register as follows.

>>> from fobi.base import form_callback_registry
>>> from fobi.contrib.plugins.form_handlers.db_store.callbacks import (
>>>     AutoFormDbStore
>>> )
>>> form_callback_registry.register(AutoFormDbStore)
callback(form_entry, request, form)[source]

Callback.

Parameters:
  • form_entry
  • request
  • form
Returns:

stage = 'form_valid'

fobi.contrib.plugins.form_handlers.db_store.conf module

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.

fobi.contrib.plugins.form_handlers.db_store.defaults module

fobi.contrib.plugins.form_handlers.db_store.fobi_form_handlers module

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.lazy.<locals>.__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.
save_form_data_entry(form_entry, request, field_name_to_label_map, cleaned_data)[source]

Save form data entry.

Might be used in integration plugins.

uid = 'db_store'
class fobi.contrib.plugins.form_handlers.db_store.fobi_form_handlers.DBStoreWizardHandlerPlugin(user=None)[source]

Bases: fobi.base.FormWizardHandlerPlugin

DB store form wizard handler plugin.

Can be used only once per form.

allow_multiple = False
custom_actions(form_wizard_entry, request=None)[source]

Custom actions.

Adding a link to view the saved form entries.

Return iterable:
 
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
run(form_wizard_entry, request, form_list, form_wizard, form_element_entries=None)[source]

Run.

Parameters:
uid = 'db_store'

fobi.contrib.plugins.form_handlers.db_store.helpers module

class fobi.contrib.plugins.form_handlers.db_store.helpers.DataExporter(queryset, only_args)[source]

Bases: object

Exporting the data.

export_to_csv()[source]

Export data to CSV.

export_to_xls()[source]

Export data to XLS.

graceful_export()[source]

Export data into XLS/CSV depending on what is available.

fobi.contrib.plugins.form_handlers.db_store.models module

class fobi.contrib.plugins.form_handlers.db_store.models.AbstractSavedFormDataEntry(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Abstract saved form data entry.

class Meta[source]

Bases: object

Meta options.

abstract = False
created

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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.

formatted_saved_data()[source]

Shows the formatted saved data records.

Return string:
get_next_by_created(**morekwargs)
get_previous_by_created(**morekwargs)
saved_data

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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 a ForwardManyToOneDescriptor instance.

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.contrib.plugins.form_handlers.db_store.models.SavedFormDataEntry(*args, **kwargs)[source]

Bases: fobi.contrib.plugins.form_handlers.db_store.models.AbstractSavedFormDataEntry

Saved form data.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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 a ForwardManyToOneDescriptor instance.

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.

get_next_by_created(**morekwargs)
get_previous_by_created(**morekwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
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 a ForwardManyToOneDescriptor instance.

class fobi.contrib.plugins.form_handlers.db_store.models.SavedFormWizardDataEntry(*args, **kwargs)[source]

Bases: fobi.contrib.plugins.form_handlers.db_store.models.AbstractSavedFormDataEntry

Saved form data.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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 a ForwardManyToOneDescriptor instance.

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.

get_next_by_created(**morekwargs)
get_previous_by_created(**morekwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
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 a ForwardManyToOneDescriptor instance.

fobi.contrib.plugins.form_handlers.db_store.settings module

  • CSV_DELIMITER (string)
  • CSV_QUOTECHAR (string)

fobi.contrib.plugins.form_handlers.db_store.views module

fobi.contrib.plugins.form_handlers.db_store.views.view_saved_form_data_entries(request, form_entry_id=None, theme=None, template_name='db_store/view_saved_form_data_entries.html')[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:
 
fobi.contrib.plugins.form_handlers.db_store.views.export_saved_form_data_entries(request, form_entry_id=None, theme=None)[source]

Export saved form data entries.

Parameters:
  • request (django.http.HttpRequest) –
  • form_entry_id (int) – Form ID.
  • theme (fobi.base.BaseTheme) – Subclass of fobi.base.BaseTheme.
Return django.http.HttpResponse:
 
fobi.contrib.plugins.form_handlers.db_store.views.view_saved_form_wizard_data_entries(request, form_wizard_entry_id=None, theme=None, template_name='db_store/view_saved_form_wizard_data_entries.html')[source]

View saved form wizard data entries.

Parameters:
  • request (django.http.HttpRequest) –
  • form_wizard_entry_id (int) – Form ID.
  • theme (fobi.base.BaseTheme) – Subclass of fobi.base.BaseTheme.
  • template_name (string) –
Return django.http.HttpResponse:
 
fobi.contrib.plugins.form_handlers.db_store.views.export_saved_form_wizard_data_entries(request, form_wizard_entry_id=None, theme=None)[source]

Export saved form wizard data entries.

Parameters:
  • request (django.http.HttpRequest) –
  • form_wizard_entry_id (int) – Form ID.
  • theme (fobi.base.BaseTheme) – Subclass of fobi.base.BaseTheme.
Return django.http.HttpResponse:
 

fobi.contrib.plugins.form_handlers.db_store.widgets module

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'

Module contents