View on GitHub

Apollo Forms

Simple and extensible CMS for forms.

Apollo attempts to be as decoupled as possible from the client project. As such, it publishes message on key events which the client may receive and react to.

The below list enumerates signals published by Apollo, as well as their signatures.

Index


form_submitted

fired when a form is submitted to the backend, but before the submission is cleaned / validated

Signature

form_submitted(raw_data, form_id, request) 
- raw_data = dictionary mapping field names to values
- form_id = ID of the Form instance submitted
- request = a django-rest-framework Request object

Example

from django.dispatch import receiver
from apollo import signals

@receiver(signals.form_submitted)
def create_new_obj(raw_data=None, form_id=None, **kwargs):
    new_form_activity = FormActivityLog.objects.create(form_id=form_id, raw_data=raw_data)
form_submission_cleaned

fired when a form has been cleaned and validated by the Apollo backend

Signature

form_submission_cleaned(cleaned_data, form_id, submission_id, request) 
- cleaned_data = dictionary mapping field names to cleaned and validated values
- form_id = ID of the Form instance submitted
- submission_id = ID of the FormSubmission instance created with the cleaned and validated data
- request = a django-rest-framework Request object

Example

from django.dispatch import receiver
from apollo import signals

@receiver(signals.form_submission_cleaned)
def create_new_obj(cleaned_data=None, form_id=None, submission_id=None, **kwargs):
    new_obj = MyObject.objects.create(**cleaned_data)
form_submission_error

fired when a form validation error occurs

Signature

form_submission_error(error, raw_data, form_id, request) 

- error = description of the error 
- raw_data = dictionary mapping field names to values
- form_id = ID of the Form instance submitted
- request = a django-rest-framework Request object

Example

from django.dispatch import receiver
from apollo import signals
import logging

logger = logging.getLogger(__name__)


@receiver(signals.form_submission_error)
def create_new_obj(error=None, raw_data=None, form_id=None, **kwargs):
    logger.error('got form submission error %s for form %s' % (error, form_id))