A contact form app for Django
Project description
django-envelope is a simple contact form app for Django web framework.
The application provides a simple contact form and a Django view to handle form submission.
Installation
Make sure you have Django installed. Then install the package from PyPI:
pip install django-envelope
or:
easy_install django-envelope
This should download and install django-envelope, along with it’s dependencies (currently only django-honeypot).
If you like living on the edge, grab the development version from Github:
git clone git://github.com/zsiciarz/django-envelope.git cd django-envelope python setup.py install
Usage
Add envelope to your INSTALLED_APPS in settings.py. The application does not define any models, so a manage.py syncdb is not needed.
For a quick start, simply include the app’s urls.py in your main URLconf, like this:
urlpatterns = patterns('', #... (r'^contact/', include('envelope.urls')), #... )
That’s basically it. Navigate to the given URL and see the contact form in action. See below for more customization options.
Configuration
These values defined in settings.py affect the application:
DEFAULT_FROM_EMAIL: This is both the sender and the recipient of the email sent with your contact form. Some web servers do not allow sending messages from an address that is different than the one used for SMTP authentication.
ENVELOPE_CONTACT_CHOICES: A tuple of pairs describing possible choices for message type. The default is defined as follows:
DEFAULT_CONTACT_CHOICES = ( ('', u"Choose"), (10, u"A general question regarding the website"), (None, u"Other"), )
The numeric values are pretty much arbitrary. Remember to leave an empty value for the choice when the field is initially unset (“Choose”).
ENVELOPE_SUBJECT_INTRO: The prefix for subject line of the email message. This is different than EMAIL_SUBJECT_PREFIX which is global for the whole project. ENVELOPE_SUBJECT_INTRO goes after the global prefix and is followed by the actual subject entered in the form by website’s user.
Default value: Message from contact form:
Customization
If you want some more fine-grained control over the contact form, you can supply additional optional arguments to the view function. Instead of including the application’s URLconf, hook the envelope.views.contact view into your urls.py. The following optional arguments are recognized by the view function:
form_class: Which form class to use for contact message handling. The default (ContactForm) is often enough, but you can subclass it if you want, or even replace with a totally custom class. The only requirement is that your custom class has a save() method which should send the message somewhere. Stick to the default, or its subclasses.
template_name: Full name of the template which will display the form. By default it is envelope/contact.html.
redirect_to: URL of the page with some kind of a “thank you for your feedback”, displayed after the form is successfully submitted. If left unset, the view redirects to itself.
extra_context: A dictionary of values to add to template context.
Example:
from my_app.forms import MyContactForm contact_info = { 'form_class': MyContactForm, 'template_name': 'my_contact.html', 'redirect_to': '/thanks/', } urlpatterns = patterns('', #... url(r'^contact/', 'envelope.views.contact', kwargs=contact_info, name='envelope-contact' ), #... )
To customize the email message sent to you, create a template called envelope/email_body.txt. You can use any of the ContactForm field names as template variables.
License
django-envelope is free software, licensed under the MIT/X11 License. A copy of the license is provided with the application in the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file django-envelope-0.2.1.zip
.
File metadata
- Download URL: django-envelope-0.2.1.zip
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f4e5ded6f792cd13c0487acd1ffc8ed72c552c93424a651016dc9773ab525dc |
|
MD5 | 431b2101977be9404a2672b7b9003767 |
|
BLAKE2b-256 | 71e6d98f9ef149e62a19075fdd6a51f9bd1cffd7d08b08e4c7b0e85632f7359e |
Provenance
File details
Details for the file django_envelope-0.2.1-py2.6.egg
.
File metadata
- Download URL: django_envelope-0.2.1-py2.6.egg
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9841a942c6847b67ef5e2c76c3154e05ff005c1e76c9c05b2a937ee81b72b9de |
|
MD5 | 7f6eecbb548cf5f93a4c350a7678fcce |
|
BLAKE2b-256 | d9347087693a9ad0e878aaed46e44486a0d6458a960a1e850e3e3eac926ee080 |
Provenance
File details
Details for the file django-envelope-0.2.1.win32.exe
.
File metadata
- Download URL: django-envelope-0.2.1.win32.exe
- Upload date:
- Size: 217.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2475af61787a574a4983874a1c03a72fce3b9d026785996474c095ad0c4e3af1 |
|
MD5 | 464ca50162f6157a69e6e460e744e781 |
|
BLAKE2b-256 | 7dc7c432b4f09bfce0b4c78a869afa680aeae1b40d783595ac54d44cb98978a0 |