1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
django-fwdform
Simple and painless form processing for static sites.
Why?
I have several sites hosted on AWS S3 for pennies a month… and I didn’t want to pay $20 per month (per form) for processing contact forms!
20+ domains powered by 1 Heroku app = Profit!
Demo
Features
Multi site support.
Unlimited forms
Unlimited submissions
Spam Protection via Akismet.
Submit forms with AJAX.
REST API to manage forms.
Quickstart
Install django-fwdform:
pip install django-fwdform
Add fwdform to INSTALLED_APPS:
INSTALLED_APPS = ( ... 'corsheaders', 'fwdform', ... )Sync database:
python manage.py migrate
Add fwdform.urls to your project’s urls module:
urlpatterns = patterns( ... url(r'^', include('fwdform.urls', namespace='fwdform')), ... )
Dependencies
This package requires django-cors-headers to be installed and configured correctly. When django-fwdform is installed using pip, django-cors-headers is automatically installed.
You will need to add corsheaders middleware class to MIDDLEWARE_CLASSES settings:
MIDDLEWARE_CLASSES = (
...
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
...
)
Note that CorsMiddleware needs to come before Django’s CommonMiddleware.
Allow CORS requests from all domains:
CORS_ORIGIN_ALLOW_ALL = True
For more information, see https://github.com/ottoyiu/django-cors-headers
Sample Form
<form action="//example.com/send/<form_hash>/" method="POST">
<input type="text" name="name" required="required"/>
<input type="email" name="email" required="required" />
<textarea name="message" rows="5"></textarea>
<input type="submit" value="Send">
</form>
Special Form Inputs
_next
By default, after submitting a form the user is shown the FwdForm “Thank You” page. You can provide an alternative URL for that page.
<input type="hidden" name="_next" value="//example.com/thanks.html" />
_subject
This value is used for the email’s subject:
<input type="hidden" name="_subject" value="Contact Form" />
_gotcha
Add this “honeypot” field. If a value is provided, the submission will be silently ignored. The input should be hidden with CSS:
<input type="text" name="_gotcha" style="display:none;" />
name/email/message
Span prevention via Akismet - Spam checker backend looks for these specially named form inputs:
<input type="text" name="name" placeholder="Your Name"> <input type="email" name="email" placeholder="Your Email"> <textarea name="message" rows="5"></textarea>
Rest API
Register a form, this returns a hashid for the newly created form:
$ curl --data "name=Contact%20Form&recipients=conttact@example.com" http://example.com/<site_token>/
{"hashid": "0rPGVlYZWqMRE8OebjoM1ogpmvNL23A9dxJzywQD"}
Update existing form config by passing a known hashid as a param:
$ curl --data "recipients=hello@example.com&hashid=0rPGVlYZWqMRE8OebjoM1ogpmvNL23A9dxJzywQD" http://example.com/<site_token>/
AJAX Submission
You can use fwdform via AJAX. This even works cross-origin.
If you’re using jQuery this can be done like so:
$.ajax({
url: $form.attr("action"),
method: "POST",
data: $form.serialize(),
dataType: "json",
headers: {"X-Requested-With": "XMLHttpRequest"},
});
Metadata
Release files for django-fwdform 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-fwdform-0.1.0.tar.gz | 15.9 kB | Details |
Release files / django-fwdform-0.1.0.tar.gz
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | django-fwdform-0.1.0.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4b7609c43f651879c6079803c9de4a74a2e7a05e743c8ef90909228d8dd9f38
|
|
BLAKE2b-256 checksum How to use checksums |
ca2d0fffba30e26812b5190c23d2b63d8bd532ec63e1e5593752c04fad7d4b61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |